Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个基于外部数据批量更新实体负载的应用程序。其中一些不会改变。NHibernate 足够聪明,可以知道实体是否已更改以及在我调用时是否发送更新DbContext.CommitChanges()。
DbContext.CommitChanges()
但是我希望能够在更新实体时输出到屏幕/日志。
如何确定是否已执行更新?我如何挂钩到 Nhibernate 更改跟踪?
NHibernate 有一个可以连接的事件系统。这是一篇博客文章,解释了您想要做什么:
NHibernate 2.0 事件和监听器
这是 NHibernate 教程中解释事件系统的部分:
第 11 章拦截器和事件
还有一个:
使用 NHibernate 事件创建审核日志