title: How to solve "there is already an open datareader associated with this connection"
body: <p>The main problem is that when the web app is launched to the internet, when the load is high an exception is raised telling that there is already an opened data reader.</p>
  
  <p>The following are the specs we use:</p>
  
  <ul>
  <li>Entityframework 5.0.0</li>
  <li>MySQL database</li>
  </ul>
  
  <p>Is there a way of solving this problem without the <code>using(){}</code> block? Main problem of this approach is that when closed the using block I can't expand foreign key relations of entityframework objects inside the html view.</p>
  
  <p>I also attach some source code, showing how we keep a single database context through the whole application</p>
  
  <pre><code>public abstract class AbstractService
  {
      public Entities db_model
      {
          get
          {
              return DbContext.Instance.db_model;
          }
      }
  }
  
  public class DbContext
  {
      public Entities db_model = new Entities();
      private static DbContext _dbContext;
  
      public static DbContext Instance
      {
          get
          {
              if(_dbContext == null)
              {
                  _dbContext = new DbContext();
              }
              return _dbContext;
          }
      }
  }
  </code></pre>