Fetch related collection into existing entity

Posts   
 
    
Meteor
User
Posts: 67
Joined: 06-Apr-2007
# Posted on: 13-Feb-2009 07:19:11   

Using adapter, C#, LLBLGen 2.6, .Net 2.0, what is the easiest way to fetch a related collection into an existing entity?

I realise that I can use Prefetch paths if I am initially instantiating the entity, but what about the case where the entity was fetched without its collections? I'd like to be able to access the collection via the original entity, rather than just retrieve a collection into a new EntityCollection object.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 13-Feb-2009 08:37:37   
CustomerEntity customer = new CustomerEntity("CHOPS");
//... fetch customer

DataAccessAdapter adapter = new DataAccessAdapter();
adapter.FetchEntityCollection(customer.Orders, customer.GetRelationInfoOrders());
Meteor
User
Posts: 67
Joined: 06-Apr-2007
# Posted on: 13-Feb-2009 14:22:29   

Thanks Walaa - I should have known.