My XManager.Fetch method simply passes the id and prefetch path to the adapter.FetchEntity method, it has some handling if the entity is not found:
public static JobsEntity Fetch( int entityId, IPrefetchPath2 pfPath) {
JobsEntity entity = new JobsEntity(entityId);
using( DataAccessAdapter adapter = ConfigurationManager.GetDataAdapterInstance() ) {
adapter.FetchEntity( entity, pfPath );
}
if ( entity.Fields.State != EntityState.Fetched ) {
entity = new JobsEntity();
entity.StatusId = (int)JobManager.DEFAULT_STATUS;
entity.StartDate = DateTime.Today;
entity.Name = "New Job";
}
return entity;
}
The code should work, but it still doesn't. Like I said, watching the code it generates in sql profiler, it's getting the data, but only the root entity is being populated. If I comment out all the subpath code (leaving the PrefetchPathJobDetailsDigitalPrint, and PrefetchPathJobFormatIdEntity), those two will work, but with the subpath code the PrefetchPathJobDetailsDigitalPrint entity is not populated. The queries work, but there's no data in the entity itself.
I hope that makes sense.