EF6 Beta1 - db.Database.CreateIfNotExists (); no longer creates the database after enabling migration

db.Database.CreateIfNotExists (); no longer creates a database and always returns true after enabling migration. I do not see anything mentioned about this in the node release. This is mistake?

Note that both AutomaticMigrationsEnabled = true or false do not work after I enable "Enable-Migrations" in the nuget console.

public void TestMethod1() { //using (var db = new Hive.Models.HiveDbContext()) { using (var db = new TestDbContext()) { var returnValue = db.Database.CreateIfNotExists(); Console.WriteLine(returnValue); } } public class TestDbContext : DbContext { } internal sealed class Configuration : DbMigrationsConfiguration<UnitTestProject1.TestDbContext> { public Configuration() { AutomaticMigrationsEnabled = true; } protected override void Seed(UnitTestProject1.TestDbContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. Eg // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // } } 
+6
source share
1 answer

The EF team told me that these are new changes to EF. Please refer to this thread. https://entityframework.codeplex.com/discussions/450998

+1
source

Source: https://habr.com/ru/post/950139/


All Articles