I'm using NHibernate as my ORM. I have a situation where I have some stuff wrapped in an ITransaction. I am listening to the SaveUpdate event in NHibernate and then doing my entity validation in that SaveUpdate handler.
For one of my entities, I want to validate that the value of a certain property hasn't changed. So I figured that I would load up the value of the existing object from the database and compare it with the new value. The problem is that I called ITransaction.Commit() to save my entity object and the transaction hasn't actually been committed at the time that validation occurs, so I can't load the existing object from the database because the transaction has it locked.
So I guess I have a few different questions here: - Is the SaveUpdate event the correct place to do validation? - Is there another way I can do this so that I can do the validation that I need to do (getting the existing value from the database and comparing)?
I'm sure someone else out there has run into a similar situation...... hopefully!