NHibernate:查找脏集合

标签 nhibernate

我知道如何 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/

相关文章:

asp.net-mvc-3 - 用于 Nhibernate 事务管理的 ActionFilter 这是一个不错的方法

asp.net-mvc-3 - nHibernate 二级缓存,带有 memcached 和随机无效强制转换

c# - NHibernate 可以设置非公共(public)属性吗?

c# - 使用 HBM 文件将字典映射到 NHibernate 中的子表

NHibernate 监视器连接

nhibernate - 使用连接表的别名创建 SqlProjection

c# - 在不使用 IUserType 查询数据库时如何防止 NHibernate SqlDateTime 溢出?

c# - 在 NHibernate 的查询中使用 OR 子句

NHibernate 代码优先迁移管理工具,如 EntityFramework、Django-South

nhibernate - Ninject 和单例