我知道如何 find dirty properties使用 NHibernate,但它似乎不适用于集合(即查明项目是否已添加或从集合中删除)。 谁知道怎么做?
最佳答案
var ipc = theEntity.TheCollection as IPersistentCollection;
var isDirty = ipc.IsDirty;
但是,请记住这一点(来自 XML 文档):
Note that this is only reliable during the flush cycle, after the collection elements are dirty checked against the snapshot.
关于NHibernate:查找脏集合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3572424/