title: Working with SessionScope, TransactionScope, ActiveRecord, C# and Trigger in SQL Server
body: <p>I'm having problems the in method create that is within a transaction and session Scope, because the table in the database has a trigger. Any suggestion?</p>
  
  <p>This is the error I get:</p>
  
  <blockquote>
    <p>An error occurred when trying to dispose the transaction<br>
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. </p>
    
    <p>Exception Details: System.Exception: An error occurred when trying to dispose the transaction</p>
  </blockquote>
  
  <p>Obs.</p>
  
  <p>If I remove the trigger, there is no error.</p>
  
  <p>Code:</p>
  
  <pre><code>using (var session = new SessionScope())
  {
     try
     {
        using (Transaction = new TransactionScope(TransactionMode.New,  OnDispose.Commit))
        {
          class.Create();
        }
        Transaction.VoteCommit();
     }
     catch (Exception ex)
     {
        Transaction.VoteRollBack();
        throw new Exception(ex.Message);
     }
  }
  </code></pre>