NHibernate's automatic (dirty checking) update behaviour - turning it off
- by Andrew Bullock
I've just discovered that if I get an object from an NHibernate session and change a property on object, NHibernate will automatically update the object on commit without me calling Session.Update(myObj)!
I can see how this could be helpful, but as default behaviour it seems crazy!
How can I stop this happening? Is this default NHib behaviour or something coming from Fluent NHibs AutoPersistenceModel?
If there's no way to stop this, what do I do? Unless I'm missing the point this behaviour seems to create a right mess, violating my UoW.
Im using NHibernate 2.0.1.4 and a Fluent NHib build from 18/3/2009
Edit, is this guy right with his answer?
Edit: I've also read that overriding an Event Listener could be a solution to this. However, IDirtyCheckEventListener.OnDirtyCheck isn't called in this situation. Does anyone know which listener I need to override?
Thanks
Andrew