Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

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

$
0
0
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" }
        //    );
        //
    }
}

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>