此代碼給我錯誤:交易已中止。 如果我刪除1個嵌套事務比不投2同胞嵌套transactionScope給出:交易已中止
using(var scope = new TransactionScope())
{
repo.Insert(new Foo {Fname = "aaaa"});
using(var s = new TransactionScope())
{
repo.Insert(new Foo { Fname = "aaaa" });
//if I remove this transaction it is not going to throw exception
using (var aaa = new TransactionScope())
{
repo.Insert(new Foo { Fname = "aaaa" });
}
using(var ssa = new TransactionScope())
{
repo.Insert(new Foo { Fname = "aaaa" });
}
}
}
@ user281180我這樣做的目的,我不希望它提交,它會拋出一個錯誤 – Omu 2010-10-05 06:42:55