2013-07-24 11 views
6

db.Database.CreateIfNotExists(); nie tworzy już bazy danych i zawsze zwraca wartość true po włączeniu migracji. Nie widzę też nic o tym wspomnianego w węźle wydania. Czy to błąd?EF6 Beta1 - db.Database.CreateIfNotExists(); nie tworzy już bazy danych po włączeniu migracji

Należy zauważyć, że zarówno AutomaticMigrationsEnabled = true, jak i false nie działają po wykonaniu "Enable-Migrations" w konsoli nuget.

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

Odpowiedz

Powiązane problemy