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.