Gre*_*ith 8 migration entity-framework
我正在玩Entity框架和持续构建.到目前为止,通过使用migrate.exe和相应的参数,我可以毫无问题地运行迁移或一系列迁移.
但是,在尝试使用migrate.exe来启动脚本而不是执行迁移时遇到了麻烦,就像我通过运行一样
update-database -TargetMigration TestMigration -script
Run Code Online (Sandbox Code Playgroud)
从Visual Studio中的程序包管理器控制台中.
目前有办法做到这一点吗?
谢谢.
自 2017 年 10 月 22 日起,您可以通过此 PR 做到这一点:https : //github.com/aspnet/EntityFramework6/commit/02ec6b8c9279f93f80eeed1234e5ce0acfce5f31
这是实现此功能的实体框架 6.2 发行说明(请参阅“Migrate.exe 应支持 -script 选项”部分):https : //blogs.msdn.microsoft.com/dotnet/2017/10/26/entity-framework- 6-2-运行时发布/
请按照以下步骤操作:
migrate.exe yourMigrationAssembly.dll /startupConfigurationFile=”..\web.config” /scriptFile="migrationOutput.sql"
它将生成文件“migrationOutput.sql”,其中包含您必须根据尚未应用的迁移在目标环境 DB 上执行的 SQL。
| 归档时间: |
|
| 查看次数: |
4266 次 |
| 最近记录: |