"The prefetch path element at index 0 in the passed in prefetch path for root entity..."

Posts   
 
    
paulc
User
Posts: 11
Joined: 03-Oct-2006
# Posted on: 09-Mar-2007 16:47:37   

This chunk of code was working fine and hasn't been changed for a long time:


EntityCollection<OperationEntity> operations = new EntityCollection<OperationEntity>();
                            
RelationPredicateBucket filters = new RelationPredicateBucket();
filters.PredicateExpression.Add(PredicateFactory.CompareValue(OperationFieldIndex.Deleted, ComparisonOperator.Equal, false));

IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.OperationEntity);
prefetchPath.Add(OperationEntity.PrefetchPathTask);

this.Adapter.FetchEntityCollection(operations, filters, -1, null, prefetchPath);

...UNTIL i added a completely unrelated entity to my llblgen project and re-generate the code. After this an exception is thrown on the FetchEntityCollection:

"The prefetch path element at index 0 in the passed in prefetch path for root entity type 36 is meant for root entity type 37 which isn't a subtype of 36. This means that you've added a prefetch path node to a Path of an unrelated entity, like adding OrderDetailsEntity.PrefetchPathProduct to a prefetch path for CustomerEntity."

There may be other bits of code which have the same problem but this is the first that's fired in my system. I think llblgen may not be regenerating properly. I have tried reverting to older project files and regenerating several times but i always end up with this exception in the end.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39888
Joined: 17-Aug-2003
# Posted on: 10-Mar-2007 11:46:37   

Please check if the file 'ConstantsEnums.cs' is re-generated. I have the feeling that file wasn't overwritten with new code, perhaps because you forgot to check it out of sourcesafe or it was readonly for example.

Frans Bouma | Lead developer LLBLGen Pro
paulc
User
Posts: 11
Joined: 03-Oct-2006
# Posted on: 12-Mar-2007 11:01:31   

ConstantsEnum.cs seems to be re-generated fine.

I just tried adding a different entity and it came up with the same problem. Then i remove the newly added entity from the project, re-gen and rebuild and it works again.

Could you tell me where in the code i can look to see the mis-matched indexes so i can try to solve the problem?

paulc
User
Posts: 11
Joined: 03-Oct-2006
# Posted on: 12-Mar-2007 11:49:31   

When debugging: prefetchPath.RootEntityType == 36 EntityType.OperationEntity == 37

paulc
User
Posts: 11
Joined: 03-Oct-2006
# Posted on: 12-Mar-2007 12:01:01   

How does the prefetch path object lookup the RootEntityType value?

btw. Operation is not derived or derives from any other entity.

paulc
User
Posts: 11
Joined: 03-Oct-2006
# Posted on: 12-Mar-2007 13:48:04   

Fixed the problem! It was down to a build problem which referenced some old cached dlls.

Thanks.