title: AddDbContext was called with configuration, but the context type 'MyContext' only declares a parameterless constructor?
body: <p>In the following console application (.Net core 2.0), the <code>scaffold-dbcontext</code> created the following <code>DbContext</code></p>
  
  <pre><code>public partial class MyContext : DbContext
  {
      public virtual DbSet&lt;Tables&gt; Tables { get; set; }
  
      protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
      {
          if (!optionsBuilder.IsConfigured) { optionsBuilder.UseSqlServer(Program.Conn); }
      }
  
      protected override void OnModelCreating(ModelBuilder modelBuilder) { .... }
  }
  </code></pre>
  
  <p>In the Main() (<code>static void Main(string[] args)</code>), the following code</p>
  
  <pre><code>var services = new ServiceCollection();
  var conn = configuration.GetConnectionString("MySource");
  services.AddDbContext&lt;MyContext&gt;(o =&gt; o.UseSqlServer(conn)); // Error
  </code></pre>
  
  <p>got the following run-time error? </p>
  
  <blockquote>
    <p>AddDbContext was called with configuration, but the context type 'MyContext' only declares a parameterless constructor. This means that the configuration passed to AddDbContext will never be used</p>
  </blockquote>