EF 4.2 Code First,使用现有数据库?
只是想弄清楚这个问题是否已经解决。
我有一个数据库(已创建),我想让 EF CF 根据模型创建缺少的表,这可能吗?
我无法删除数据库/为此创建一个新数据库,我只是希望它根据模型维护表)。
像 DropTablesIfModelChanges 或类似的东西。
Just trying to figure out if this has been solved or not.
I have a database (already created) and i want to let EF CF create the tables that are missing based on the models, is that possible?
I can't delete the database/create a new database for this, i just want it to maintain the tables based on the models).
Something like DropTablesIfModelChanges or similar.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 EntityFramework.SqlMigrations 来完成此操作,
可以使用 NuGet 进行此
操作Scott Hanselman 写了一篇不错的博客文章关于那个。
实体框架代码优先迁移
希望这有帮助
You can do this using EntityFramework.SqlMigrations
It is avaliable using NuGet
Scott Hanselman wrote a nice blog post about that.
Entity Framework Code First Migrations
hope this helps