I'm trying to fill a graph of entities.
I've got the following tables/entities:
Master:
MasterId
1
Child (references Master):
ChildId MasterId
1 1
2 1
GrandChild (references Master and Child):
GrandChildId MasterId ChildId
1 1 1
2 1 1
3 1 1
4 1 1
5 1 1
6 1 2
Is it possible to fill my entities so I can traverse from Master to Child to GrandChild to Master?
I'd like the following statement to be correct:
Master.Child[0].GrandChild[0].Master == Master
With this code:
IPrefetchPath2 prefetchPath = new PrefetchPath2((int) EntityType.MasterEntity);
prefetchPath.Add(MasterEntity.PrefetchPathChild).SubPath.Add(ChildEntity.PrefetchPathGrandChild);
I get this result:
Master.Child.Count -> 2 //OK
Master.GrandChild.Count -> 0 //Expected to be 6
Master.Child[0].GrandChild.Count -> 5 //OK
Master.Child[1].GrandChild.Count -> 1 //OK
Master.Child[0].GrandChild[0].Master -> null //Expected to equal Master
With this code:
IPrefetchPath2 prefetchPath = new PrefetchPath2((int) EntityType.MasterEntity);
prefetchPath.Add(ReportMasterEntity.PrefetchPathGrandChild);
prefetchPath.Add(ReportMasterEntity.PrefetchPathChildCollectionViaGrandChild);
I get this result:
Master.Child.Count -> 0 //Expected to be 2
Master.GrandChild.Count -> 6 //OK
Master.GrandChild[0].Child -> null //Expected to be a ChildEntity
I've spent some time searching this forum for a sollution, but haven't found one.