期望的结果:
在实体框架中使用模型优先方法,并允许根据模型中的更改自动更改已部署的数据库/模型.自动生成架构差异脚本以实现平滑迁移.
Use model first approach with Entity Framework and allow changes to deployed database/ model to be done automatically based on the changes in the model. Automatic schema difference script generation to allow smooth migrations.
有没有办法在模型优先 EF6 中执行迁移?我可以看到到处都是代码优先迁移主题,但在 Model First 上什么都没有.
Is there a way to perform migrations in model first EF6? I can see code first migrations topics all over, but nothing much on Model First.
目前我看到的选项:
- 数据库生成电源组(似乎已过时)
- 先以某种方式转换为代码,然后使用迁移(不可取,因为我喜欢有视觉设计师)
- 以某种方式搭载代码优先迁移(blog.amusedia/2012/08/entity-framework-migration-with-model.html:这是针对 EF5,出现无法在 Model First 上运行迁移的错误)
- 一些第三方工具?
- Database generation power pack (seems outdated)
- somehow convert to code first, then use migrations (not desirable, as I like to have a visual designer)
- somehow piggy back on code first migrations (blog.amusedia/2012/08/entity-framework-migration-with-model.html : this is for EF5, got error that can't run migrations on Model First)
- some third party tools?
据我所知目前还没有自动迁移Entity framework model first.
As far as I know there still is no automatic migration for Entity framework model first.
我们的做法是:
我们首先使用 Open DB diff 进行模型首次迁移.之后我们切换到 Redgate 的 SQL 比较,因为它产生了更可靠的迁移.根据我们的经验,DbDiff 产生了很多不必要的 SQL,因为它影响了列的顺序,并且还有一些其他问题,例如不断删除和重新添加外键.除此之外,它仍然可以正常工作,但我们必须对其生成的 SQL 进行大量的双重检查.
We first used Open DB diff for our model first migrations. After that we switched to Redgate's SQL compare because it produced more reliable migrations . In our experience DbDiff produced a lot of unnecessary SQL because it bothers with the order that columns are in, and has some other issues like foreign keys constantly being dropped and re-added. Aside from that it still did the job fine, but we had to do a lot of double checking on its generated SQL.
更多推荐
Entity Framework 6 模型优先迁移
发布评论