Expand in linq not loading inner data collections from service.
Posted
by Kit
on Stack Overflow
See other posts from Stack Overflow
or by Kit
Published on 2010-05-01T04:59:21Z
Indexed on
2010/05/01
5:07 UTC
Read the original article
Hit count: 279
I am seeing odd behavior with service queries! I am using MVVM pattern for a silverlight 3 app on 3.5 framework and Dataservices 1.5.
The following code eager loads correctly the parent object and the child heirarchy perfectly IF and ONLY IF I am preloading the data. But I would like to fetch a different set of the parent object (and its child heirarchy) on different button clicks. What I am seeing is that on button click, only the parent object is retrieved, and the child heirarchy contains nothing. Any suggestions? Any ideas how to tackle this? Thanks all.
The method:
DataServiceQuery serviceQuery = (DataServiceQuery)(from m1 in dbEntities.gis_Region.Expand("gis_RegionValue/gis_Measure") where m1.RegionGuid == new Guid(regionGuid) select m1);
serviceQuery.BeginExecute(GetRegionDetailAsyncResult, serviceQuery);
The wired Async Result:
DataServiceQuery query = (DataServiceQuery)result.AsyncState;
gis_Region region = query.EndExecute(result).First();
© Stack Overflow or respective owner