title: ADO.Net Entity Framework Transactions
body: <p>I want to ask which is the right way to use transactions in ADO.Net Entity Framework  (call,rollback,commit) ? I have this code, but this give me exception </p>
  
  <pre><code>"Invalid operation. The connection is closed." 
  </code></pre>
  
  <p>(In this code NorthwindEntities inherit "DBContext")</p>
  
  <pre><code>NorthwindEntities context = new NorthwindEntities();
  DbTransaction tran = context.Database.Connection.BeginTransaction();
  var cust = context.Customers.FirstOrDefault(x =&gt; x.CustomerID == "BOLID");
  cust.Country = "Nigeria";
  context.SaveChanges();
  tran.Rollback();
  </code></pre>