title: Entity Framework and transaction isolation level
body: <p>I'm using Entity Framework 4.0. Now I need to restrict access to a table while I'm reading from it or writing to it. Probably that's about transaction isolation level.</p>
  
  <p>How do I do that?</p>
  
  <p><strong>Update</strong></p>
  
  <p>here is what I have</p>
  
  <pre><code>using (var db = new MyDb())
  {
      using (TransactionScope scope = new TransactionScope())
      {
          var item = db.MyItems.Single(x =&gt; x.Id == 5);
          item.Price = 12;
          db.SaveChanges();
          scope.Complete(); 
      }
  }
  </code></pre>
  
  <p>However, when I put a breakpoint at any line inside <code>using (TransactionScope scope</code> and when I'm stopping there and then I go to Sql Server Management Studio and doing a select query (or even update!) from a table that is using inside a transaction, I'm not getting an error for some reason. But why? It must not allow me to read a data while a transaction is executing.</p>