|
This seems to be a basic concurrency function, but I was having trouble finding any answer to my question elsewhere.
NHibernate V1.2
Consider the following scenario:
I have a smart client which loads a large amount of data, manipulates it in memory, and persists the changes when user interaction is finished.
The user loads object foo in a session
ISession session = NhibernateHelper.GetCurrentSession();
Foo foo = session.Get(typeof(Foo),id);
session.Disconnect();
<time goes by... foo is changed locally> <call to to persist the changes>
session.Reconnect();
//before updating, check to see if any property of foo has changed in the database
if(foo has changed)
{
notify the user that foo has changed in the database
}
else
{
session.SaveOrUpdate(foo);
}
The current definition of a "stale" object seems to mean a key-property has changed, but I need to see both key and non-key property changes.
How do I check to see if ANY properties of an object have persisted changes before updating?
|