在这段代码中...
实际上,在这种情况下...
public static TransactionScope CreateTransactionScope(bool createNew = false)
{
return new TransactionScope(
createNew ? TransactionScopeOption.RequiresNew : TransactionScopeOption.Required,
new TransactionOptions() { IsolationLevel = IsolationLevel.ReadCommitted });
}
实际上,在这种情况下...
using (TransactionScope rootScope = CreateTransactionScope())
{
using (TransactionScope nestedOne = CreateTransactionScope())
{ nestedOne.Complete(); }
using (TransactionScope nestedTwo = CreateTransactionScope(true))
{ nestedTwo.Complete(); }
// No committing, rollback 'rootScope'.
}
当根事务被回滚时,将与其一起回滚哪些事务 - 是仅 nestedOne
还是同时包括 nestedOne
和 nestedTwo
?