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

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

问题描述

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

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.

期待感谢.

推荐答案

试试这个:

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

更新:

你也可以试试这个:

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

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

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