title: A provider can be configured by overriding the DbContext.OnConfiguring
body: <p>For some reason since I added a Application User class ,it says I have two contexts which I do not but I created the class as follows as it said to do so: </p>
  
  <pre><code>public class ApplicationDbContextFactory : IDbContextFactory&lt;solitudeDContext&gt;
      {
          public solitudeDContext Create(DbContextFactoryOptions options)
          {
              var optionsBuilder = new DbContextOptionsBuilder&lt;solitudeDContext&gt;();
              return new solitudeDContext(optionsBuilder.Options);
          }
      }
  }
  </code></pre>
  
  <p>But now it is saying the following:</p>
  
  <blockquote>
    <p>No database provider has been configured for this DbContext. A
    provider can be configured by overriding the DbContext.OnConfiguring
    method or by using AddDbContext on the application service provider.
    If AddDbContext is used, then also ensure that your DbContext type
    accepts a DbContextOptions object in its constructor and
    passes it to the base constructor for DbContext.</p>
  </blockquote>
  
  <p>This is my db context layer:</p>
  
  <pre><code>public class solitudeDContext : IdentityDbContext&lt;IdentityUser&gt;
      {  public solitudeDContext(DbContextOptions&lt;solitudeDContext&gt; options) : base(options)
          {
          }
          public DbSet&lt;basketheader&gt; BasketHeader { get; set; }
          public DbSet&lt;basketlines&gt; BasketLines { get; set; }
          public DbSet&lt;customer&gt; Customer { get; set; }
  
          protected override void OnModelCreating(ModelBuilder builder)
          {
              base.OnModelCreating(builder);
  
              builder.Entity&lt;ApplicationUser&gt;(entity =&gt;
              {
                  entity.ToTable(name: "AspNetUser", schema: "Security");
                  entity.Property(e =&gt; e.Id).HasColumnName("AspNetUserId");
  
              });
  
          }
      }
  </code></pre>
  
  <p>Anyone know what is up here?  I am using ASP.NET CORE 1.1. Before I used my own Application user for Identy and this compiled fine. So I enclose it below in case something is wrong there.</p>
  
  <pre><code>public  class ApplicationUser: IdentityUser
  {
          public string FirstName { get; set; }
          public string LastName{ get; set; }
          public DateTime dob { get; set; }
  }
  </code></pre>
  
  <p>My <code>startup.cs</code>:</p>
  
  <pre><code> // This method gets called by the runtime. Use this method to add services to the container.
      public void ConfigureServices(IServiceCollection services)
      {
          // Add framework services.
          services.AddMvc();
          services.AddDbContext&lt;IdentityDbContext&gt;(options =&gt;
          options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"),b=&gt;b.MigrationsAssembly("solitudeeccore")));
          services.AddIdentity&lt;IdentityUser, IdentityRole&gt;()
     .AddEntityFrameworkStores&lt;IdentityDbContext&gt;()
     .AddDefaultTokenProviders();
          services.AddTransient&lt;IMessageService, FileMessageService&gt;();
          services.AddAuthentication();            
      }
  
      // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
      public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
      {
          loggerFactory.AddConsole(Configuration.GetSection("Logging"));
          loggerFactory.AddDebug();
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();                
          }
          else
          {
              app.UseExceptionHandler("/Home/Error");
          }
  
          app.UseStaticFiles();
          app.UseIdentity();
          app.UseMvc(routes =&gt;
          {
              routes.MapRoute(
                  name: "default",
                  template: "{controller=Home}/{action=Index}/{id?}");
          });
  
  
      }
  </code></pre>
  
  <p>My only guess is that now because I am using Application User Identity, user is making donet compiler thinking two contexts ?</p>