Roll back changes to object if invalid
- by hhravn
How do i roll back changes to an attached object in nhibernate? We have a validation before update/save (example simplified)..
var setting = Get("key")
setting.Value = "helo" //for whatever reason, this particular
//setting cannot have its value saved to the database
...
Verify(setting); //throws
base.Update(setting);
but since the object is attached, any changes already happened in the session, even if the validation throws, and never reaches Update. What is the proper way to handle this?