NHibernate:拦截器和侦听器的区别 [英] NHibernate: difference between Interceptor and Listener

查看:24
本文介绍了NHibernate:拦截器和侦听器的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看 NHibernate 中创建/更新列的所有可能性,我主要是 (Stackoverflow 问题Ayende Rahien) 参见侦听器的解决方案.

Looking at all the possibilites of creation / update columns in NHibernate I mostly (Stackoverflow question, Ayende Rahien) see solutions with Listeners.

在我公司编写此程序的程序员使用 Interceptor 来实现相同的功能.

The programmer who was programming this in my company used an Interceptor to achieve the same thing.

这两种解决方案有什么区别吗?(其中之一已过时,其中之一是首选以及优点和/或缺点是什么)

Is there any difference between those two solutions? (Is one of them obsolete, is one of them preferred and what are the advantages and / or disadvantages)

推荐答案

拦截器是旧的方式,事件监听器更新并且服务相同的目的.所以在新项目中,推荐使用事件监听器.您连接到新的 NHibernate 事件系统.

Interceptors are the the old way, event-listeners are newer and server the same purpose. So in a new project, event-listeners are recommended. You hook up to the new NHibernate event system.

正如 Rashack 在他的评论中提到的,有些操作只能使用拦截器来完成.

As Rashack mentions in his comment, there are some operations that can only be done using the interceptor.

这篇关于NHibernate:拦截器和侦听器的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆