title: Nested/Child TransactionScope Rollback
body: <p>I am trying to nest TransactionScopes (.net 4.0) as you would nest Transactions in SQL Server, however it looks like they operate differently. I want my child transactions to be able to rollback if they fail, but allow the parent transaction to decide whether to commit/rollback the whole operation.  The problem is when the first complete occurs, the transaction is rolled back. I realize that complete is different to commit.</p>
  
  <p>A greatly simplified example of what I am trying to do:</p>
  
  <pre><code>static void Main(string[] args)
  {
      using(var scope = new TransactionScope()) // Trn A
      {
          // Insert Data A
  
          DoWork(true);
          DoWork(false);
  
          // Rollback or Commit
      }
  }
  
  // This class is a few layers down
  static void DoWork(bool fail)
  {
      using(var scope = new TransactionScope()) // Trn B
      {
          // Update Data A
  
          if(!fail)
          {
              scope.Complete();
          }
      }
  }
  </code></pre>
  
  <p>I can't use the Suppress or RequiresNew options as Trn B relies on data inserted by Trn A. If I do use those options, Trn B is blocked by Trn A.</p>
  
  <p>Any ideas how I would get it to work, or if it is even possible using the System.Transactions namespace?</p>
  
  <p>Thanks</p>