Analyzing dynamically instantiated collections and prefetch paths

Posts   
 
    
Sokon1
User
Posts: 97
Joined: 17-Jul-2006
# Posted on: 22-Sep-2006 11:36:03   

Hi!

I instantiate an entity collection by using Activator.GetInstance. Now I want to analyze the collection and for each field containing a FK, I'd like to add a prefetch path, so the related collections are fetched when i call GetMulti(...) later.

Because the entity collection is created dynamically, I don't know the property names of the prefetch paths the entity contains. And because the prefetch paths of an entity seem to be static properties instead of a collection, it is not possible to access them when the collection is created dynamically.

I tried looping through the entities fields to get the information i want, creating my own PrefetchPathElements (tons of parameters stuck_out_tongue_winking_eye ), and everything ended in a mess. Is there any other way? I'd be thankful for any suggestion simple_smile

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 22-Sep-2006 16:28:41   

This seems to be a similar question: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=2019

Anyway for this particular case, I'd suggest using SelfServicing to benefit from the LazyLoad feature. Where the related entity is loaded once you access the corresponding related field in an entity.