Since the NHibernate ISession tracks changes, I am wondering if I can discard all changes in a session, like this:
class Person
{
public virtual string Name { get; set; }
}
// Somewhere else...
var session = sessionFactory.OpenSession();
person.Name = "John Doe";
using(var tx = session.BeginTransaction)
{
session.Save(person);
tx.Commit();
}
person.Name = "Jane Doe";
// Now, can I do something like this?
session.RevertAll();
Assert.AreEqual("John Doe", person.Name);