如何在Entity Framework 4.3.1中禁用迁移? [英] How to disable migration in Entity Framework 4.3.1?

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

问题描述

有什么方法可以禁用Entity Framework 4.3.1中的迁移?我从项目中删除了Migrations文件夹,并从数据库中删除了生成的表格,但这是行不通的!如何删除迁移?

Is there any way to disable migration in Entity Framework 4.3.1? I removed the migrations folder from the project and the generated tables in my database, but it doesn't work! How can you remove the migration?

推荐答案

如果您不想使用迁移,但同时又希望EF为您创建数据库,您只需要设置正确的数据库初始化程序即可:

If you don't want to use migrations but in the same time you want EF to create database for you, you just need to set correct database initializer:

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

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

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