开发者

WCF RIA : LoadOperation Not Refreshing Data

开发者 https://www.devze.com 2023-03-23 21:09 出处:网络
I have the following code: LoadOperation<Clarifications> ClarificationsLP = context.Load(context.GetClearificationsQuery().Where(o => o.ProjectID == ((App)Application.Current).Project.Projec

I have the following code:

LoadOperation<Clarifications> ClarificationsLP = context.Load(context.GetClearificationsQuery().Where(o => o.ProjectID == ((App)Application.Current).Project.ProjectID).OrderBy(o => o.RaisedOn));
ClearificationsL开发者_C百科P.Completed += delegate {//Stuff };

When I execute this statement the second time, it does not pick up new changes from the database??

Any Idea?

Thanks,

Rick


Try this: (I broke out the GetClearifictionsQuery just to make the code more clear, it's the load behavior that you want to pay attention to)


var query = context.GetClearificationsQuery().Where((o => o.ProjectID == ((App)Application.Current).Project.ProjectID).OrderBy(o => o.RaisedOn));
LoadOperation ClarificationsLP = context.Load(query, LoadBehavior.MergeIntoCurrent);
ClearificationsLP.Completed += delegate {//Stuff };

Also, have a look here to make sure that you are choosing the correct LoadBehavior (there are 3):

http://msdn.microsoft.com/en-us/library/system.servicemodel.domainservices.client.loadbehavior(v=VS.91).aspx

The default behavior (if you don't pass one) is LoadBehavior.KeepCurrent, which I think explains the behavior that you are getting.

0

精彩评论

暂无评论...
验证码 换一张
取 消