2013-07-24 35 views
6

db.Database.CreateIfNotExists(); không tạo cơ sở dữ liệu nữa và luôn trả về true sau khi bật di chuyển. Tôi không thấy bất cứ điều gì được đề cập về nó trong nút phát hành nữa. Nó có phải là lỗi không?EF6 Beta1 - db.Database.CreateIfNotExists(); không tạo cơ sở dữ liệu nữa sau khi bật di chuyển

Lưu ý rằng cả AutomaticMigrationsEnabled = true hoặc false đều không hoạt động sau khi tôi thực hiện "Enable-Migrations" trong bảng điều khiển 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" } 
     // ); 
     // 
    } 
} 

Trả lời

1

Nhóm EF đã trả lời tôi rằng đó là một thay đổi mới trong EF. Vui lòng tham khảo chủ đề này. https://entityframework.codeplex.com/discussions/450998

+0

Đó là một liên kết bị hỏng ngay bây giờ, có lẽ nó được chuyển đến github? –

Các vấn đề liên quan