There is some kind of detour, but, may be, there is more accurate
solution?

using (var session = _sessionFactory.OpenSession())
using (var transaction = session.BeginTransaction())
{
        var saved = session.SaveOrUpdateCopy(entity) as EntityBase;
        session.Flush();
        if(saved.Version==entity.Version) // seems like hack. Do not upgrade
version if it's already upgraded
        {
                session.Lock(saved,LockMode.Force); // tnx to Ayende blog
        }
        transaction.Commit();
        return saved;
}

--

You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=.


Reply via email to