The DbContext of type cannot be pooled because it does not have a single public constructor accepting a single parameter of type DbContextOptions : <p>I am trying to upgrade our current .Net Core application from 1.1 to 2.0 and am getting this runtime error: "The DbContext of type 'CoreContext' cannot be pooled because it does not have a single public constructor accepting a single parameter of type DbContextOptions".</p>

<p>It is caused by using the new IServiceCollection.AddDbContextPool&lt;> function. When I use IServiceCollection.AddDbContext&lt;> it still works.</p>

<p>This application is DB-First, so I generate all our contexts using 'Scaffold-DbContext'. Due to that, and the need to inject other services I have an extension on every context like this:</p>

<pre><code>public partial class CoreContext
{
    public CoreContext(
        DbContextOptions&lt;CoreContext&gt; options,
        IUserService userService,
        IAuditRepository auditRepository
        ) : base(options) {...}
}
</code></pre>

<p>Whenever I run the Scaffold-DbContext I just remove the autogenerated Constructor from CoreContext, but even if I put it in there I still get this error.</p>

<pre><code>public partial class CoreContext : DbContext
{
    public CoreContext(DbContextOptions&lt;CoreContext&gt; options) : base(options) {}
}
</code></pre>

<p>I've already updated Program.cs to the new style:</p>

<pre><code>public class Program
{
    public static void Main(string[] args)
    {
        BuildWebHost(args).Run();
    }

    public static IWebHost BuildWebHost(string[] args) =&gt;
        WebHost.CreateDefaultBuilder(args)
                .UseKestrel()
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseIISIntegration()
                .UseStartup&lt;Startup&gt;()
                .Build();
}
</code></pre>

<p>And the Startup.cs is pretty straightforward:</p>

<pre><code>public IServiceProvider ConfigureServices(IServiceCollection services)
{
    ...
    services.AddDbContextPool&lt;CoreContext&gt;(options =&gt; options.UseSqlServer(absConnectionString));
    ...
}
</code></pre>

<p>I am using Autofac for DI if that helps. For now I'll default back to the non-Pooling alternative, but it would be nice to take advantage of this feature.</p>
