NHibernate: difference between Interceptor and Listener

梦想与她 提交于 2019-11-27 06:39:10

问题


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

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)


回答1:


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.

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



来源:https://stackoverflow.com/questions/867341/nhibernate-difference-between-interceptor-and-listener

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!