title: How to get the database context in a controller
body: <p>I am trying all day to figure out to get the <code>ApplicationDbContext</code> in the <code>ManageController.cs</code> of a default MVC 6 project.</p>
  
  <p>I went online and Googled a lot but no one seems to have the same problem as I have with it. It is probably simple but I can't figure it out. 
  Anyone has an idea?</p>
  
  <p>Here is what I tried:</p>
  
  <pre><code>IServiceProvider service = new IServiceProvider();
  var _context = service.GetService&lt;ApplicationDbContext&gt;();
  </code></pre>