title: Why Migrations are not working for EF core?
body: <pre><code>PM&gt; Add-Migration
  cmdlet Add-Migration at command pipeline position 1
  Supply values for the following parameters:
  Name: Initial
  System.ArgumentNullException: Value cannot be null.
  Parameter name: connectionString
     at Microsoft.EntityFrameworkCore.Utilities.Check.NotEmpty(String value, String parameterName)
     at Microsoft.EntityFrameworkCore.SqlServerDbContextOptionsExtensions.UseSqlServer(DbContextOptionsBuilder optionsBuilder, String connectionString, Action`1 sqlServerOptionsAction)
     at EFarmerPkModelLibrary.Context.EFarmerDbModel.OnConfiguring(DbContextOptionsBuilder optionsBuilder) in D:\New folder\projects\Agri-Project\ServerApp\EFarmer.pk\EntityModelLibrary\Entities\EFarmerModel.EFarmerDbModel.cs:line 57
     at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
     at Microsoft.EntityFrameworkCore.Internal.InternalAccessorExtensions.GetService[TService](IInfrastructure`1 accessor)
     at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(Func`1 factory)
     at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(String contextType)
     at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.AddMigration(String name, String outputDir, String contextType)
     at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType)
     at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.&lt;&gt;c__DisplayClass3_0`1.&lt;Execute&gt;b__0()
     at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
  Value cannot be null.
  Parameter name: connectionString
  </code></pre>
  
  <p>I am getting this error on creating migration</p>
  
  <p>Below is my configuration of DbContext class</p>
  
  <pre><code>string connectionString;
          public EFarmerDbModel() :
              base()
          {
              OnCreated();
          }
          public EFarmerDbModel(DbContextOptions options) :
              base(options)
          {
              OnCreated();
          }
          public EFarmerDbModel(string connectionString) :
              base(GetOptions(connectionString))
          {
              this.connectionString = connectionString;
              OnCreated();
          }
          //protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
          //{
          //    optionsBuilder.UseLazyLoadingProxies()
          //        .UseSqlServer(connectionString);
          //    base.OnConfiguring(optionsBuilder);
          //}
          private static DbContextOptions GetOptions(string connectionString)
          {
              return SqlServerDbContextOptionsExtensions.UseSqlServer(new DbContextOptionsBuilder(), connectionString).Options;
          }
          protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
          {
                  optionsBuilder.UseLazyLoadingProxies()
                  .UseSqlServer(connectionString);
              optionsBuilder.UseSqlServer(connectionString,
                  x =&gt; x.MigrationsAssembly("EFarmerPkModelLibrary.Migrations"));
              CustomizeConfiguration(ref optionsBuilder);
              base.OnConfiguring(optionsBuilder);
          }
  
          partial void CustomizeConfiguration(ref DbContextOptionsBuilder optionsBuilder);
  </code></pre>
  
  <p>I want to mention here that I have scaffold the Db Context and entity framework class by reverse engineering the database. And I am using the Entity Framework in a library file.</p>