title: Using TransactionScope with Entity Framework 6
body: <p>What I can't understand is if its possible to make changes to the context and get the changes in the same transaction before its commited.</p>
  
  <p>This is what I´m looking for:</p>
  
  <pre><code>using (var scope = new TransactionScope(TransactionScopeOption.Required)) 
  { 
      using (var context = new DbContext()) 
      { 
          //first I want to update an item in the context, not to the db
          Item thisItem = context.Items.First();
          thisItem.Name = "Update name";
          context.SaveChanges(); //Save change to this context
  
          //then I want to do a query on the updated item on the current context, not against the db
          Item thisUpdatedItem = context.Items.Where(a=&gt;a.Name == "Update name").First();
  
          //do some more query
      } 
  
      //First here I want it to commit all the changes in the current context to the db
      scope.Complete(); 
  } 
  </code></pre>
  
  <p>Can someone help me understand and show me a working pattern?</p>