Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NHibernate: difference between Interceptor and Listener

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)

like image 424
bernhardrusch Avatar asked May 15 '09 07:05

bernhardrusch


1 Answers

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.

like image 192
Stefan Steinegger Avatar answered Oct 22 '22 15:10

Stefan Steinegger