Finally, the following code works just fine:

Class1 c1;
Class2 c2;
Class1DTO dto;
using (ISession s = _sessions.OpenSession())
{
    using (ITransaction tx = s.BeginTransaction())
    {
        c1 = new Class1();
        c2 = new Class2();

        c1.AddClass2(c2);

        s.Save(c2);

        s.Save(c1);

        dto = new Class1DTO { ID = c1.ID, EntityVersion =
c1.EntityVersion };

        tx.Commit();
    }

    Assert.AreEqual(1, c1.EntityVersion);
    Assert.AreEqual(1, c2.EntityVersion);
    Assert.AreEqual(c1.ID, dto.ID);
    Assert.AreEqual(1, dto.EntityVersion);
}

Assert.AreEqual(1, c1.EntityVersion);
Assert.AreEqual(1, c2.EntityVersion);
Assert.AreEqual(c1.ID, dto.ID);
Assert.AreEqual(1, dto.EntityVersion);

-- 
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=en.

Reply via email to