EF6 Beta1 - db.Database.CreateIfNotExists(); doesn't create the database anymore after enabling the migration

entity-framework entity-framework-6

Question

db.Database.CreateIfNotExists(); doesn't create the database anymore and always return true after enabling the migration. I don't see anything mentioned about it in release node as well. Is it the bug?

Note that both AutomaticMigrationsEnabled = true or false are not working after I do "Enable-Migrations" in 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. E.g.
        //
        //    context.People.AddOrUpdate(
        //      p => p.FullName,
        //      new Person { FullName = "Andrew Peters" },
        //      new Person { FullName = "Brice Lambson" },
        //      new Person { FullName = "Rowan Miller" }
        //    );
        //
    }
}

Popular Answer

EF team responded me that it's a new changes in EF. Please refer to this thread. https://entityframework.codeplex.com/discussions/450998




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why