title: No parameterless constructor was found on 'TContext'
body: <p>I am not really clear on why the error happens. When I first scaffold my project the migration and update-database commands ran fine but after few changes in the application I was getting <a href="https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet#error-no-parameterless-constructor-was-found" rel="nofollow noreferrer">this error</a>. The only solution floating around is <a href="https://docs.microsoft.com/en-us/ef/core/miscellaneous/configuring-dbcontext" rel="nofollow noreferrer">this</a>:</p>
  
  <pre><code>public class BloggingContextFactory : IDbContextFactory&lt;BloggingContext&gt;
  {
      public BloggingContext Create()
      {
          var optionsBuilder = new DbContextOptionsBuilder&lt;BloggingContext&gt;();
          optionsBuilder.UseSqlite("Data Source=blog.db");
  
          return new BloggingContext(optionsBuilder.Options);
      }
  }
  </code></pre>
  
  <p>
  My DbContext:</p>
  
  <pre><code>public class ApplicationDbContext : IdentityDbContext&lt;ApplicationUser&gt;, IApplicationDbContext
  {
      public DbSet&lt;ApplicationUserCode&gt; ApplicationUserCodes { get; set; }
  
      public ApplicationDbContext(DbContextOptions&lt;ApplicationDbContext&gt; options)
          : base(options)
      {
      }
  
      protected override void OnModelCreating(ModelBuilder builder)
      {
          base.OnModelCreating(builder);
          // Customize the ASP.NET Identity model and override the defaults if needed.
          // For example, you can rename the ASP.NET Identity table names and more.
          // Add your customizations after calling base.OnModelCreating(builder);
      }
  }
  </code></pre>
  
  <p>It works for me but the connection string is hard-coded inside the class which is not fine with me. Any clarifications as to why this error did not happen at one time and later it did is really appreciated and also a elegant solution than embedding connection string in class please.</p>