views:

1048

answers:

1

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 on of them obsolete, is one of them preferred and what are the advantages and / or disadvantes)

+3  A: 

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.

Stefan Steinegger
That's not entirely true. Although event listeners are newer and recomended there are certain operations that you cannot do with them. Namely providing your way to instatiate objects and capturing transaction start/ends.
Rashack
Thanks for this hint. I didn't know this.
Stefan Steinegger