Prefetch multiple relations with same table

Posts   
 
    
dan
User
Posts: 17
Joined: 23-Feb-2006
# Posted on: 25-May-2006 20:23:41   

Hello I have Product table, and UnitMeaure table

there are 2 releations between product and unitmeasure

1 using Product.UnitMeasure property 2 using Product.WeightUnitMeasure property

I need to construct prefetch clause that will return me product object and 2 related unitMeasure objects

how would i do that?

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 26-May-2006 08:27:23   
IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.ProductEntity);
prefetchPath.Add(ProductEntity.PrefetchPathUnitMeasure);
prefetchPath.Add(ProductEntity.PrefetchPathWeightUnitMeasure);
dan
User
Posts: 17
Joined: 23-Feb-2006
# Posted on: 26-May-2006 10:16:36   

Hello Thank You for your answer

but unforunately there is no such property

Error 1 'ErpNet.Business.EntityClasses.ProductEntity' does not contain a definition for 'PrefetchPathWeightUnitMeasure' C:\Erp\tmp\ErpNet.Business\Finders\BaseFinder.cs 78 44 ErpNet.Business

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 26-May-2006 14:38:20   

That was a wild guess, you should have more than one prefetchPathSomething property targeting the related table, that's if there is 2 relations already defined between the main table (Product Entity) and that target table (Unit Measure).

Please make sure the relations are already defined in the LLBLGen Pro designer and then examine the generated code to see the PrefetchPath properties generated.