I have a certain graph of objects, which can be very complex -object contains several children objects and they also contain their children objects, etc.
I need to render a list of such objects on page.
List can be relitivly long, and I think lazy initialization is not appropriate for this, since it will hit the database N*M-times,for each item in list and for each not-loaded child property in a row at least.
But not all properties of complex object need to be rendered on list page, and thus complete loading oaf every item is not good too.
What is the best approach to accomplish this kind of task - query complex objects with ony query to database and load only needed data.
Is it the same as 'LightWeight object' pattern ? I would like to reuse the same objects used on list also on 'details' page with extra properties mapped.
Thanks.
|