Monday, May 24, 2010

WCF RIA Services: Loading associated entities

Just a quick note to self: when you want to load associated entities in query you have to do it at two places,

1- in the query itself using the Include method

public IQueryable<MasterEntity> GetItems()
{
return this.ObjectContext.MasterItems.Include("DetailsEntities");
}


2- in the associated metadata class



 internal sealed class MasterEntityMetadata
{
private MasterEntityMetadata()
{
}

[Include]
public EntitySet<DetailsEntity> DetailsEntities;

}

No comments: