Hi Garrett, prefetches aren't done by default as it WILL hurt performance in the long run and you're then stuck with the prefetch even when you don't want to load the related entities.
I never did that. However I can think in two options:
A. Write some Manager class that take care of the fetch, save, etc., then you add the desired prefetchpath and return the fetched collection.
public static class CustomerManager
{
public static EntityCollection<CustomerEntity> GetAllCustomers()
{
EntityCollection<CustomerEntity> toReturn = new EntityCollection<CustomerEntity>(...);
IPrefetchPath2 path = new PrefetchPath((int) EntityType.Customer);
path.Add(CustomerEntity.PrefetchPathOrders);
....
return toReturn;
}
}
B. Extend DataAccessAdapter, override FetchEntityCollection, and there you can pass the prefetchPathToUse depending on the fetching entity to the base call.