title: How to use TransactionScope in Entity Framework
body: <p>I am developing student marking system using ASP.NET MVC and Entity Framework. There is a heavy method I am using for calculate marking. At a given time there are about 50 users enter marks to system and that heavy method call by all the users. It  gives me deadlock most of the time. I am using a <code>TransactionScope</code>. </p>
  
  <p>This is my code:</p>
  
  <pre><code>try
  {
      using (context = new SIMSDBAPPEntities())
      {
          using (TransactionScope scope = new TransactionScope())
          {
                // My heavy calculation
          } 
  
          scope.Complete();
          context.SaveChanges();           
      }
      catch (Exception ex)
      {
          throw ex;
      }
  }
  </code></pre>
  
  <p>My heavy method is running inside a <code>TransactionScope</code>. I want to know whether my code has any problems? If yes, what can I do to avoid deadlock situation?</p>