I've upgraded silverlight project from 4 to 5 and now have compilation error where I load data to the DomainContext:
Context.Load(Context.GetMyEntityQuery(), LoadBehavior.RefreshCurrent, null, null);
The call is ambiguous between the following methods or properties:
'System.ServiceModel.DomainServices.Client.DomainContext.Load<MyEntity>(System.ServiceModel.DomainServices.Client.EntityQuery<MyEntity>, System.ServiceModel.DomainServices.Client.LoadBehavior, System.Action<System.ServiceModel.DomainServices.Client.LoadOperation<MyEntity>>, object)
'System.ServiceModel.DomainServices.Client.DomainContext.Load (System.ServiceModel.DomainServices.Client.EntityQuery, System.ServiceModel.DomainServices.Client.LoadBehavior, System.Action<System.ServiceModel.DomainServices.Client.LoadOperation>, object)'
Any ideas how to fix this (and I have > 100 such errors)?
Edit
Calling like this helps:
Context.Load<MyEntity>(Context.GetMyEntityQuery(), LoadBehavior.RefreshCurrent, null, null);
The culprit is this overload (assembly System.ServiceModel.DomainServices.Client.dll, v2.0.5.0)
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual LoadOperation Load(EntityQuery query, LoadBehavior loadBehavior, Action<LoadOperation> callback, object userState);
together with this
public LoadOperation<TEntity> Load<TEntity>(EntityQuery<TEntity> query, LoadBehavior loadBehavior, Action<LoadOperation<TEntity>> callback, object userState) where TEntity : Entity;
It seems the later is enough so why the former is included? Anyway, will investigate further (it seems I reference the latest ria services 1.0 SP2, cleaning everything and rebuilding not helping).
I used to load data to DomainContext in the following way.
public void GetPersonObjectDataFromService(Action<LoadOperation<TempPersonDTO>> loadData)
{
var query1 = this.tpDataProviderContext1.GetPersonObjectDataFromServiceQuery();
tpDataProviderContext1.Load(query1, LoadBehavior.RefreshCurrent, loadData, null);
}
TempPersonDTO is Class which having data. Thank you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.