简体   繁体   English

逐个运行多个Entity Framework命令

[英]running multiple Entity Framework commands one by one

Is it possible to run scripts in Package manager Console to update Entity Framework with multiple commands? 是否可以在程序包管理器控制台中运行脚本以使用多个命令更新Entity Framework? I'd want a script like: 我想要一个像这样的脚本:

Update-database -migration oldTragetMigration
remove-migration
remove-migration
add-migration newMigration
update-database

I want to be able to run the script in sequences so that I don't have to wait for each step to take place? 我希望能够按顺序运行脚本,以便我不必等待每个步骤发生?

Not even sure if I can write ac# script for that kind of thing. 甚至不确定我是否可以为这种事情编写ac#脚本。

Thanks in advance! 提前致谢!

You can always add new file in your project ( right click on project -> Add New Item -> Text file ), and name it, for example 您总是可以在项目中添加新文件( right click on project -> Add New Item -> Text file ),然后命名它,例如

script.ps1 

Edit it, put your commands inside, save. 编辑它,将命令放入其中,保存。 Open Package Manager Console and run it. 打开包管理器控制台并运行它。 You will need to specify path, like this: 您将需要指定路径,如下所示:

.\[project folder]\script.ps1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM