Using Free NHibernate I have a property in a class displayed using Version
Version(x => x.Version);
When I save the object, the Version property is incremented in the database, as expected, but the value of the object property only changes occasionally.
using (var tx = session.BeginTransaction())
{
session.Merge(item);
tx.Commit();
item.Version; // Sometimes this is still 1, when I expect it to be 2.
}
The problem is that if it remains equal to 1, and I make more changes and save again, I get a StaleObjectStateException.
What is strange is that sometimes it works fine, and the value of item.Version increases correctly, but I can not understand the difference between the cases when it works and the cases when it is not.
, . - , NHibernates ?
[NHibernate version 2.1.2]