R – NHibernate: difference between Interceptor and Listener

interceptorlistenernhibernate

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)

Best Answer

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.

Related Topic