Reputation: 59
We have got a Silverlight 5 application. We have two tables in the database linked through a Linked table. e.g. Event and User are the main tables and EventToUser is the linked table. The user can add user to an event i.e. who can receive/raise this event.
The issue is: Client A, opens an existing event and adds a User 'Bob' to it. Client B opens the same event and sees that User Bob is added to it. Client B also adds another user 'Fred' to this event.
Both clients can see that User 'Bob' and User 'Fred' are added to this event. Client B decides to remove the User 'Bob' from the event. none Client A still sees user 'Bob' when reloading the data through the RIA service. When debugging, I found that the on the server side, the correct data is returned but when it comes back to the client (the callback function), the linked table still has the deleted data i.e. The user 'Bob' is still linked to the event.
I tried to Clear the linked table on the Context on the client side but to no avail. I am not sure what else to do. I have set the LoadBehviour to 'RefreshCurrent'. Can someone please suggest a solution, I would really appreciate it.
Regards,
Nasir.
Upvotes: 0
Views: 93
Reputation: 6415
On your client context, you should do something like:
SubjectContext.EntityContainer.GetEntitySet<Event>().Clear();
SubjectContext.EntityContainer.GetEntitySet<User>().Clear();
SubjectContext.EntityContainer.GetEntitySet<EventToUser>().Clear();
... before making a query, if you are reusing your context rather than creating a new client context each time. This is because that clients context will still contain the items that have been deleted from the db.
We also have things like this in our code:
this.SubjectContext.Events.Clear();
... but I'm not 100% on the distinction between the two.
Upvotes: 1