1

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));
ClearificationsLP.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

Jehof
  • 34,674
  • 10
  • 123
  • 155

1 Answers1

1

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.

JMarsch
  • 21,484
  • 15
  • 77
  • 125