Search code examples
.netsilverlightsilverlight-4.0riasilverlight-toolkit

RIA Services: Enumerate Deleted Entities


My RIA service context class has an entity set TaskToOperationAssociations which contains a list of Task to Operation associations.

Is there a way to "find" an association entity which has been removed from the collection? I can see that the context has a reference to the removed Association in it's private fields (it obviously needs to keep track of it so the delete operation can be submitted).

Here's an example...

If I have Task "A" (with Id=T1) which is associated to Operation X, Y and Z (with id's O1,O2 and O3) and task B (with Id=T2) is associated with the same operations then the collection will contain 3 TaskToOperationAssociations as follows...

  1. Association A1, TaskId = T1, OperationID = 1
  2. Association A2, TaskId = T1, OperationID = 2
  3. Association A3, TaskId = T1, OperationID = 3
  4. Association A4, TaskId = T2, OperationID = 1
  5. Association A5, TaskId = T2, OperationID = 2
  6. Association A6, TaskId = T2, OperationID = 3

I remove association A1 and catch the property change event of the TaskToOperationAssociations. In the event handler I want to find out if any of the associations for Task T1 have changed so I can enable a save button on the UI.

Hope this makes sense. Thanks Ben


Solution

  • There is no way to do this using only the context. I fixed it by wrapping the context and tracking deletions manually.