此代码给我错误:交易已中止。 如果我删除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