Multi prefetch from the prefetched table

Posts   
 
    
bvalle
User
Posts: 54
Joined: 07-Jun-2006
# Posted on: 30-Aug-2006 23:55:05   

Hello

I looked in the manual and could not find anything to do the following. Could someone please help me?

Here is the my database.

|Site| -one to many-> |SiteAssembly| -one to one-> |SiteGeoLocation|

and also |SiteAssembly| -one to one-> |SitePoint|

Basically I have an entity Site and I would like to pull SiteGeoLocation and SitePoint, however these two are related to SiteAssembly which Site is related to.

When trying this I get an "The PrefetchPathElement you to tried to add is already added to this PrefetchPath.\r\nParameter name: elementToAdd" on the second prefetch statment:


prefetchPath.Add(SiteEntity.PrefetchPathSiteAssemblyData).SubPath.Add(SiteAssemblyEntity.PrefetchPathSiteGeoLocation);
prefetchPath.Add(SiteEntity.PrefetchPathSiteAssemblyData).SubPath.Add(SiteAssemblyEntity.PrefetchPathSitePoint);

What should I be doing here to be able to prefetch those two tables?

Thank you, Bruno Valle

bvalle
User
Posts: 54
Joined: 07-Jun-2006
# Posted on: 31-Aug-2006 00:01:00   

Ok, sorry... figure it out... I should be pulling SiteAssembly and then prefetchig everything else.

I guess this is one of those rubber ducking things... once you explain to someone then everything makes sense...

Thanks

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 31-Aug-2006 06:58:36   

Or you can fetch the Site and still prefetch everything else.


IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.SiteEntity);    

IPrefetchPathElement2 prefetchPathElement = SiteEntity.PrefetchPathSiteAssembly;            
prefetchPathElement.SubPath.Add(SiteAssemblyEntity.PrefetchPathSiteGeoLocation);
prefetchPathElement.SubPath.Add(SiteAssemblyEntity.PrefetchPathSitePoint);
prefetchPath.Add(prefetchPathElement);