Self Referencing Table - Populating?

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 05-Jun-2009 19:38:40   

I have a self referencing entity based on the table "Module" which has this definition for the field 'ChildModules':

Returns a typed collection with one or more instances of the entity 'Module' which are directly related to the instance of the entity 'Module' where Module.ModulePk=Module.ParentModuleFk

I populate a EntityCollection via a simple linq query:

            var q = (ILLBLGenProQuery)from r in linq.Module
                                      select r;
            return q.Execute<EntityCollection<ModuleEntity>>();

I databind this to a DevEx Tree and it looks correct, with heirachical data.

However, the field **ChildModules **is always empty.

Do I need to 'fill' this child collection in some way?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 05-Jun-2009 19:46:36   

Sure. You should use LINQ2LLBL PrefetchPaths. Please read the section that link point to, so you could decide if you want to use PathEdges or LambdaExpressions.

David Elizondo | LLBLGen Support Team