Prefetch Hierarchy

Posts   
 
    
garrett
User
Posts: 33
Joined: 21-Feb-2008
# Posted on: 30-Aug-2008 03:51:49   

Hi

I've a self-referencing table mapping onto an entity with relations called Parent(m:1) and Children(1:n).

I want to load the entire hierarchy up and then recurse through adding it to a treeview.

I've loaded the entire entity collection (using linq and then calling ToList()) and although the ParentID property is correct on the appropriate entities, the actual Parent property returns null?

Is there something special I have to do to get the Parent property returning the actual Parent entity?

Thanks Garrett

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 30-Aug-2008 07:05:00   

Hi Garret,

When using LINQ2LLBL you need to use prefetchPaths this way.

Please let us know whether that's what you are looking for, and whether you need further help on this. If you need such help, post the code snippet you have so far wink

David Elizondo | LLBLGen Support Team
garrett
User
Posts: 33
Joined: 21-Feb-2008
# Posted on: 30-Aug-2008 21:46:31   

Thanks but I got the prefetch paths for some other entities - my question is why, when i load an entire table hierarchy the parent and children properties are not populated?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 31-Aug-2008 08:04:21   

Could you please post your code snippet and what are the not-populated children?

David Elizondo | LLBLGen Support Team