I created a .net core 2 class library. and I created the entities and entities type configurations. I created the DbContext
public class EFDBContext : DbContext
{
public EFDBContext(DbContextOptions options) : base(options)
{
}
}
then I created a TemporaryDbContextFactory
public class TemporaryDbContextFactory : IDesignTimeDbContextFactory<EFDBContext>
{
public EFDBContext CreateDbContext(string[] args)
{
var builder = new DbContextOptionsBuilder<EFDBContext>();
builder.UseSqlServer("Name=AppConnectionString",
optionsBuilder => optionsBuilder.MigrationsAssembly(typeof(EFDBContext).GetTypeInfo().Assembly.GetName().Name));
return new EFDBContext(builder.Options);
}
}
I'm trying to run Add-Migration but I got nothing. the migration is not created
So what am I missing here ??