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" }
// );
//
}
}
EF team responded me that it's a new changes in EF. Please refer to this thread. https://entityframework.codeplex.com/discussions/450998
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With