I have in DB the mapped table with id 7, field Taex with value “qwe”
in this code:
var fooObj = Foo.GetById(7);
fooObj.Taex = "abc";
using (new TransactionScope(OnDispose.Rollback))
{
var originalFooObj = Foo.GetById(7);
// how can i do to get real original object from database into a transaction
bool areEquals = fooObj.Taex == originalFooObj.Taex; // are equals
// because nhibernate gets the cached object.
}
i need the db original data into the transaction, how can i do ?
NHibernate has
Refreshmethod. You can use it to force NH to reload entity from DB