I am using NHibernate (v 2.1.0.4000) and try to use an event Listener for an update action.
I used the following code to add a listener to the Nhibernate Configuration.
var configuration = new Configuration();
configuration.SetListener(ListenerType.Update, new UpdateListener());
_sessionFactory = configuration.BuildSessionFactory();
When I am updating two items, the first item does not get to the "PerformUpdate" function of the listener. However, when updating the second item, the function is being called.
How can this happen?
---Edited---
While debugging I found out that on the "OnSaveOrUpdate" of the Listener , the following code is being executed:
object obj4 = session.PersistenceContext.UnproxyAndReassociate(@event.Entity);
@event.Entity = obj4;
@event.Entry = session.PersistenceContext.GetEntry(obj4);
I expected that @event.Entry was null, but it was not null and had a status Loaded. What should really happen when calling the GetEntry method?