title: How to run two Entity Framework Contexts inside TransactionScope without MSDTC?
body: <p>This problem is not readily reproducible in a simple example here but was wondering if anyone has any experience and tips, here is the issue:</p>
  
  <ul>
  <li>using <strong>Entity Framework</strong> </li>
  <li>have many points in application where (1) data is written to some <strong>entity</strong> table e.g. Customer, (2) data is written to <strong>history</strong> table</li>
  <li><strong>both</strong> of these actions use Entity Framework, HOWEVER, they use <strong>different</strong> contexts</li>
  <li>these actions need to be both in <strong>one transaction</strong>: i.e. if one fails to write, the other should not write, etc.</li>
  <li>I can wrap them with a TransactionScope, </li>
  </ul>
  
  <p>like this:</p>
  
  <pre><code>using (TransactionScope txScope = new TransactionScope()) {
      ...
  }
  </code></pre>
  
  <p>but this gives me:</p>
  
  <blockquote>
    <p>Microsoft Distributed Transaction Coordinator (MSDTC) is disabled for
    network transactions.</p>
  </blockquote>
  
  <p>Our database admin has told me that <strong>MSDTC</strong> is disabled by choice and <strong>can not be installed</strong>.</p>
  
  <p>Hence I am making changes trying to create my own EntityConnection with a MetadataWorkspace with the idea that <strong>each context will use the same EntityConnection</strong>. However, this is proving near impossible trying to get it to work, e.g. currently I continue to get the above error even though theoretically both contexts are using EntityConnection. It's difficult to understand where/why Entity Framework is requiring the MSDTC for example.</p>
  
  <p><strong>Has anyone gone down this road before, have experience or code examples to share?</strong></p>