title: Reference Key Error in Transaction Scope Using Entity Framework
body: <p>I am Using <code>Transaction Scope</code> for Performing the Insert In Multiple Tables using <code>Try and Catch</code>. But when i am Getting the Error Within <code>Transaction Scope</code> it's not allowing me to Save the Data in <code>catch</code> also.</p>
  
  <p><strong>My Code</strong></p>
  
  <pre><code>using (var transaction = new TransactionScope())
  {
     try
     {
       //Insert in Table1
       //Insert in Table2
       //Insert in Table3
  
       transaction.Complete();    
       transaction.Dispose();    
     }
     catch(Exception ex)
     {
       transaction.Dispose();
       //Insert in ErrorHandlerTable (Independent Table)
     }
  }
  </code></pre>
  
  <p>Now The Problem is whenever i am getting the error in <code>try</code> block for <code>foreign key constraints</code> i am unable to insert into ErrorHandlerTable (Independent Table). Always Getting Following <code>Exception</code>:</p>
  
  <pre><code>{"The INSERT statement conflicted with the FOREIGN KEY constraint \"FK_Table1_PkId\". The conflict occurred in database \"MyTransactionDatabase\", table \"dbo.Table2\", column 'PkId'.\r\nThe statement has been terminated."}
  </code></pre>
  
  <p>Can anyone help in this?</p>