title: how to change isolation level?
body: <p>I am using EF 4.0, and I would like to use the isolation level <code>serializable</code>, because in a transaction I would like to block a register when is read.</p>
  
  <p>Well, in SQL Server I try to change the isolation level with this command:</p>
  
  <pre><code>SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
  </code></pre>
  
  <p>And in C# I use this code to try to block the register:</p>
  
  <pre><code>using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.Serializable }))
  {
     Entities myContext = new Entities();
     string colors = "select * from Colors where IDColor = 2";
     Colors myColor = myContext.Colors.SqlQuery(colors).FirstOrDefault&lt;Colors&gt;();
     myColor.Color = "Red";
     myContext.SaveChanges();
     scope.Complete();                  
  }
  </code></pre>
  
  <p>If I execute line by line my code, if I get the <code>SaveChanges</code> but still is not execute, if I do a query to the table colors with SQL Server Management Studio for example, I can get the record. </p>
  
  <p>Then, if I execute the save changes and I get the <code>scope.Clompete()</code>, the if I try the query with Management Studio, I get nothing because the register is blocked, so when I finish my C# code, the register is release and I get the result in Management Studio.</p>
  
  <p>So my question is, how to use the serializable isolation level in C#? am I doing something wrong?</p>
  
  <p>P.S.: I notice that if I use this command:</p>
  
  <pre><code>DBCC useroptions;
  </code></pre>
  
  <p>I see that the isolation level is <code>serializable</code>, but if I close Management Studio and connect again and see the isolation level is the default <code>readCommitted</code>.</p>
  
  <p>So my question is how to set the default isolation level for my database.</p>