本文介绍了RIA服务:枚举删除实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的RIA服务环境类有一个实体集TaskToOperationAssociations其中包含的任务来操作的关联列表。

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...

如果余有任务的A(与标识= T 1),其相关联的操作的X,Y和Z(与ID的O1,O2和O3)和任务B(与标识= T2)与相同的操作相关联那么集合将包含3 TaskToOperationAssociations如下...

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. 协会A1,任务id = T1,OperationID = 1
  2. 协会A2,任务id = T1,OperationID = 2
  3. 协会A3,任务id = T1,OperationID = 3
  4. 协会A4,任务id = T2,OperationID = 1
  5. 协会A5,任务id = T2,OperationID = 2
  6. 协会A6,任务id = T2,OperationID = 3

我删除联想A1和赶上TaskToOperationAssociations的属性更改事件。在事件处理程序我想看看是否有任何关联的任务T1的改变了,所以我可以使保存在UI按钮。

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.ThanksBen

推荐答案

有没有办法只使用范围内做到这一点。我被包裹的背景和人工跟踪缺失固定它。

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

这篇关于RIA服务:枚举删除实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 03:42