lawrenson2008 wrote:
prefetchPath = new PrefetchPath2((int)EntityType.HCClientCallRecordEntity);
prefetchPath.Add(HCClientCallRecordEntity.PrefetchPathUser);
prefetchPath.Add(HCClientCallRecordEntity.PrefetchPathHCClientDetails).SubPath.Add(HCClientDetailsEntity.PrefetchPathClient);
This allows you to navigate and explore the intermediate entities. For example:
somevalue = theRecordsResults[_someRecord].HCClientDetails[_someClientDetail].SomeField;
// or
int countClientDetailOfSomeRecord = theRecordsResults[_someRecord].HCClientDetails[_someClientDetail].Count;
// etc.
lawrenson2008 wrote:
prefetchPath.Add(HCClientCallRecordEntity.PrefetchPathClientCollectionViaHCClientDetails);
Here you can:
- Access the ClientCollection in this way:
someValue = theRecordsResults[_someRecord].ClientCollectionViaHCClientDetails[_someClient].SomeField;
but you cant access some HCClientDetails object and then access its Client collection (or entity).
Copied from manual(LLBLGenProHelp - Using the generated code - Adapter - Prefetch paths - Advanced Prefetch Paths - M:N related entities):
M:N related entities
Prefetch Paths can also be used to fetch m:n related entities, they work the same as other related entities. There is one caveat: the intermediate entities are not fetched with an m:n relation Prefetch Path. For example, if you fetch a set of Customer entities and also their m:n related Employee entities, the intermediate entity, Order, is not fetched. If you specify, via another PrefetchPathElement2, to fetch the Order entities as well, and via a SubPath also their related Employee entities, these Employee entities are not the same objects as located in the Employees collection of every Customer entity you fetched.