Making the Main Entity Aware of the Sub Items

At this point, we have a fully functional collection of child records (sub items), but the main business entity is not yet aware of this object. Therefore, we have to add code that instantiates the new collection when the business entity instantiates.

  1. Add an internal field of type "ProductImagesCollection" to the "ProductBusinessEntity" class
    • Expose the collection as a read-only property called "ProductImages".

  2. Override the LoadSubItemsCollection method
    1. Instantiate the collection object and pass a reference to the current entity as a constructor parameter.
    2. Set the table that is used by this collection

You should now have added the following code to your ProductBusinessEntity class:



Last Updated: 8/7/2006