parent entity and related collection

Posts   
 
    
methodman
User
Posts: 194
Joined: 24-Aug-2009
# Posted on: 02-Oct-2009 10:49:47   

Hi there.

I have two entities in relation 1:m. I need to fetch the parent entity (partner) including the entity collection of the descendant entity. I came up with this.It works,but i not sure if this is the proper approach calling the adapter twice. Shouldn't i use PrefetchPath ? I'm pretty new to llblgen so i'm little bit confused :-)


using (DataAccessAdapter adapter = new DataAccessAdapter())
{
               PartnerEntity partner = new PartnerEntity(id);
               EntityCollection<UcetEntity> ucty = partner.Ucet;

               adapter.FetchEntity(partner);
               adapter.FetchEntityCollection(ucty, partner.GetRelationInfoUcet());

               return partner;
}

Thx in advance!

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 02-Oct-2009 11:39:47   

In this specific case, both approaches will have the same effect, regarding results and performance.

But nevertheless, you should have a lok at the prefetchPaths in the docs.