2013-07-24 11 views
6

db.Database.CreateIfNotExists(); non crea più il database e restituisce sempre true dopo aver abilitato la migrazione. Non vedo nulla di menzionato in questo nodo di rilascio. È l'errore?EF6 Beta1 - db.Database.CreateIfNotExists(); non crea più il database dopo aver abilitato la migrazione

Nota che sia AutomaticMigrationsEnabled = true o false non funzionano dopo aver eseguito "Enable-Migrations" nella console di 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" } 
     // ); 
     // 
    } 
} 

risposta

Problemi correlati