How to eager load in WCF Ria Services/Linq2SQLDomainModel

Posted by Aggelos Mpimpoudis on Stack Overflow See other posts from Stack Overflow or by Aggelos Mpimpoudis
Published on 2010-02-03T01:38:40Z Indexed on 2010/03/12 16:27 UTC
Read the original article Hit count: 863

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!

© Stack Overflow or respective owner

Related posts about entity-framework

Related posts about wcf-ria-services