R – Force NHibernate to issue an update

ajaxasp.netnhibernate

I'm having a problem with an ASP.NET application that uses NHibernate with the session-per-request model. I'm storing an object in SessionState and updating some of its properties using AJAX postbacks. When the user clicks "save" I lock the object to the current ISession and update its properties from the form. The problem occurs if the user only updates properties through AJAX postbacks because in that case the object isn't "dirty" in the current session. How can I force NHibernate to issue an update?

Best Answer

I found a way to achieve this by using ISession.Merge. It requires an additional select but it will do for now.