I originally thought this was a INotifyPropertyChanged/Binding issue because I’m not sure how to debug the silverlight part. So I had to put a messagebox in a foreach loop and view the values after the data returned that way. It turns out that I’m having trouble getting the updated data from the service. I use the service to do some updates to data on the server and when it gets back call to reload the data. This part of the service is returning the correct data (I verified using a breakpoint so I could look at the data result was holding). But the silverlight side is not getting the right data. Here is the relevant code.
public IQueryable<OurClass> GetItems(string condition)
{
var result = from items in context.OurClass
where item.value == condition
select item;
return result; //had my breakpoint here and the values were the correct updated values
}
/
Context.Load<OurClass>(Context.GetItemsQuery(condition)).Completed += new EventHandler(Context_LoadCompleted);
/
private void Context_LoadCompleted(object sender, EventArgs e)
{
IEnumerable<OurClass> result = ((LoadOperation<OurClass>)sender).Entities;
//This is where I put a MessageBox to view the returned results and the data was different
//than what was contained in the other result
}
Any ideas what could cause this? What should I look at next?
EDIT:
Some example data is OurClass.OurProperty will equal “Test” on the server side but once it is received on the client it will equal “Development” which was the old value. The IEnumerable will hold the newly added records and not have the deleted ones. Any that previously existed will contain the old property values and not the new values.
The solution was that I needed to add the parameter LoadBehavior.RefreshCurrent to the query call. So this:
Needed to be this: