title: How to configure DbContext of EntityFrameworkCore when using NInject
body: <p>In the ConfigureServices of .net core startup class you can configure dbcontext as follows.</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddDbContext&lt;DotNetCoreT1DbContext&gt;(options =&gt; options.UseSqlServer(_configuration.GetConnectionString("DefaultConnection")));
  
      services.AddMvc();
  }
  </code></pre>
  
  <p>How do I configure this, if I use NInject or may be Autofac?</p>
  
  <p>With NInject, I tried the following. </p>
  
  <pre><code>kernel.Bind&lt;DotNetCoreT1DbContext&gt;().ToMethod(m =&gt; new DotNetCoreT1DbContext(GetDbContextOptionsForCurrentRequest()));
  </code></pre>
  
  <p>with GetDbContextOptionsForCurrentRequest defined as follows.        </p>
  
  <pre><code>private DbContextOptions GetDbContextOptionsForCurrentRequest()
  {
     var options = new DbContextOptions();
     return options;
  }
  </code></pre>
  
  <p>The problem is I cannot newup DbContextOptions and so the above does not work. Its not a public ctor.</p>
  
  <p>How do I go about using NInject or Autofac and configure EF Core DbContext?</p>