How to apply migrations from code (EF Core)

c# ef-migrations entity-framework-core

Question

How to apply migrations from code

for EF6 work code

    Database.SetInitializer<CmContext>(null);
    var settings = new MigrationsConfiguration();
    var migrator = new DbMigrator(settings);
    migrator.Update();

how to make similar in EF Core?

1
15
9/6/2017 12:19:56 PM

Popular Answer

In beta 7 and on, use:

using Microsoft.Data.Entity;

...

context.Database.Migrate();
14
11/17/2015 7:24:37 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow