且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在EntityFramework 4.3中为现有数据库创建迁移?

更新时间:2023-12-01 09:30:22

这里介绍一个很好的步骤: http://thedatafarm.com/data-access/using-ef-4- 3-code-first-migrations-with-a-existing-database /

A nice walk-through for this is posted here: http://thedatafarm.com/data-access/using-ef-4-3-code-first-migrations-with-an-existing-database/

我建议的一个改变是简单地注释掉Up和Down方法,直到部署迁移。之后,您可以取消注释代码,如果需要,您可以创建一个新的数据库。

The one change I would suggest is to simply comment out the code in the Up and Down methods until you have deployed the migration. After that, you can uncomment the code and that will allow you to create a new database if you need to later.