我在DB id爲7的映射表,字段Taex值爲「QWE」的TransactionScope問題
在此代碼:
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.
}
我需要的數據庫原始數據轉化爲交易,怎麼能我做 ?
我試圖使用ActiveRecordMediator.Evict(fooObj),但不起作用,我試圖克隆對象,但是,作爲屬性的惰性對象(其他實體)通過通過參考,我會克隆他們,一些想法? – manuellt 2012-02-20 13:43:37