Search code examples
c#sql-servertransactionscopemsdtc

Rollback the transaction after calling transaction.complete()


Is it possible for me to rollback the transaction after calling scope.complete() ? Will nested transaction work in this case ? Are there any other alternatives too. I am compelled to add scope.complete in order to call MyService correctly. But I want to rollback transaction at the end.


Solution

  • You can have nested scopes. All scopes must complete for the transaction to complete as well. Scope != transaction.

    So the inner scope could complete and the outer scope could rollback. That would rollback the transaction in effect.