I am having some (more) issues with my Telerik OpenAccess ORM. This time in the area of applying Fetch Strategies to a query. Here's the code ...
using (DAL.DarkRoomDB ctx = new DarkRoomDB())
{
//
// Set the resulting object to include the contents of the package
FetchStrategy strategy = new FetchStrategy();
strategy.LoadWith<DeliverablePackageEntity>(c => c.PackageContents);
strategy.LoadWith<DeliverablePackageContentEntity>(c => c.Deliverable);
strategy.LoadWith<DeliverablePackageContentEntity>(c => c.DeliverablePackage);
strategy.MaxFetchDepth = 3;
ctx.FetchStrategy = strategy;
//
// get the package that matches the SKU
DataStoreRepository<DeliverablePackageEntity> repo = DataStoreRepository<DeliverablePackageEntity>.GetInstance(ctx);
DeliverablePackageEntity entity = repo.GetEntityList(c => c.PackageSku == SKU).FirstOrDefault();
//
// Create a DISCONNECTED COPY of the entity
copy = ctx.CreateDetachedCopy<DeliverablePackageEntity>(entity, strategy);
}
ret = EntityToDomainMapper.Map<DeliverablePackageEntity, DeliverablePackage>(copy);
return ret;
When I run this I expect the PackageContents of the DeliverablePackageEntity to be pre-loaded. When I look at the entity variable in the debugger however it tells me that the "contents of the property will be enumerated when expanded" which would suggest to me that the property has not yet been pre-populated, which is what I thought the purpose of the FetchStrategy was.
Am I missing something?