Prefetching Objects from Subclassed objects

Posts   
 
    
bjacobs
User
Posts: 73
Joined: 20-Aug-2008
# Posted on: 16-Jun-2009 17:03:02   

I have the following scenario using Adapter.

  1. I am retrieving a EntityCollection<Order> and Order is a base class for MedicationOrder and LabOrder.
  2. LabOrder has a Lab object property.
  3. MedicationOrder has a Drug object property.

How would I prefetch the Lab and Drug properties from the subclassed objects since I am fetching a list of Order objects?

Thanks,

Billy Jacobs

bjacobs
User
Posts: 73
Joined: 20-Aug-2008
# Posted on: 16-Jun-2009 19:33:53   

I think I figured it out.

        EntityCollection<OrderManifestsEntity> orderManifests = new EntityCollection<OrderManifestsEntity>();
        PrefetchPath2 prefetchPath = new PrefetchPath2(EntityType.OrderManifestsEntity);
        IPrefetchPathElement2 prefetchPathOrders = prefetchPath.Add(OrderManifestsEntity.PrefetchPathOrdersList_);
        prefetchPathOrders.SubPath.Add(OrdersEntity.PrefetchPathAdministerTime_).SubPath.Add(AdministerTimesEntity.PrefetchPathAdministerTimeType_);
        prefetchPathOrders.SubPath.Add(OrdersEntity.PrefetchPathPatientDiagnosis_).SubPath.Add(PatientDiagnosesEntity.PrefetchPathDiagnoses);
        prefetchPathOrders.SubPath.Add(OrdersEntity.PrefetchPathEncounteredBy);
        prefetchPathOrders.SubPath.Add(LabOrdersEntity.PrefetchPathLab_);
        prefetchPathOrders.SubPath.Add(MedicationOrderEntity.PrefetchPathDrug_);

LLBLGEN is smart!!!!! stuck_out_tongue_winking_eye

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-Jun-2009 05:32:16   

LLBLGEN is smart!!!!! stuck_out_tongue_winking_eye

Yes, it's simple_smile

David Elizondo | LLBLGen Support Team