title: Dispose DbContext in MVC Controller, which way "better"?
body: <p>In MVC 5, the scaffolding codes will have something like:</p>
  
  <pre><code>    public class MyController : Controller
  {
      private MyContext db = new MyContext();
  
      protected override void Dispose(bool disposing)
      {
          if (disposing)
          {
              db.Dispose();
          }
          base.Dispose(disposing);
      }
  </code></pre>
  
  <p>otherwise, I need to have</p>
  
  <pre><code>using (var db = new MyContext())
  {...}
  </code></pre>
  
  <p>in each action.</p>
  
  <p>The codes look good, so I don't need to use using in each action. However, is this subject to preference of programmers, or such style has some advantage over using in each action that needs to use the dbcontext?</p>