I am having the following issue: Sometimes, when I am issuing a DomainService call using WCF RIA Services, I got the callback right but the loadoperation I have assigned has no results, meaning no entities are returned and the “IsComplete” property is false.
The following code resumes what I am doing, including the LoadOperation definition, the calling function and the callback function:
LoadOperation lo;
private void CallDomainService(){
DomainContext dc = new DomainContext();
lo = dc.Load(dc.GetDataQuery());
lo.Completed += new EventHandler(lo_Completed);
}
And it executes well and calls properly lo_completed…
void lo_Completed(object sender, EventArgs e){
}
}
The issue is that I am getting properly the details of the load Operation, but some random times, it does not return the object properly, it is not null but its .IsComplete property is False and the Entities collection is empty, though that it has had been processed properly by the server.
The trick or workaround here is to get, in this exact case, the loadoperation from the server, which is a reference to the right load operation. The code should be like this:
LoadOperation<EntityType> lo2 = (LoadOperation<EntityType>)sender;
}
And with this, problem solved.
Are you having this random issue or others? anybody found why this is happening?