如何在Entity Framework 6.0中禁用迁移 [英] How can I disable migration in Entity Framework 6.0

查看:166
本文介绍了如何在Entity Framework 6.0中禁用迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图忽略使用Entity Framework 6.0 rc1的自动迁移。我的问题是,我现在不想要这个功能,每次我的应用程序运行我都可以看到所有的实体日志试图创建所有的表。



预期的谢谢。

解决方案

尝试这样:

  internal sealed class配置:DbMigrationsConfiguration< YourContext> 
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
}
}

更新: p>

您也可以尝试这样:

  Database.SetInitializer< YourContextType>新的CreateDatabaseIfNotExists()); 


I'm trying to ignore the "Automatic" migration using Entity Framework 6.0 rc1. My problem is that I don't want this feature right now and every time that my application runs I can see all entity logs trying to create all tables.

Anticipate thanks.

解决方案

Try this:

internal sealed class Configuration : DbMigrationsConfiguration<YourContext>
{
    public Configuration()
    {
        AutomaticMigrationsEnabled = false;
    }
}

UPDATE:

You can also try this:

Database.SetInitializer<YourContextType>(new CreateDatabaseIfNotExists());

这篇关于如何在Entity Framework 6.0中禁用迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆