How to eager load in WCF Ria Services/Linq2SQLDomainModel
- by Aggelos Mpimpoudis
I have a databound grid at my view (XAML) and the Itemsource points to a ReportsCollection. The Reports entity has three primitives and some complex types. These three are shown as expected at datagrid. Additionally the Reports entity has a property of type Store. When loading Reports via GetReports domain method, I quickly figure out that only primitives are returned and not the whole graph of some depth. So, as I wanted to load the Store property too, I made this alteration at my domain service:
public IQueryable<Report> GetReports()
{
return this.ObjectContext.Reports.Include("Store");
}
From what I see at the immediate window, store is loaded as expected, but when returned to client is still pruned. How can this be fixed?
Thank you!