如何在EntityFramework Codefirst中以编程方式使用迁移? [英] How to use migration programmatically in EntityFramework Codefirst?
问题描述
添加迁移TestMigration01 -force
update-database
你有几个选择。您可以在代码中使用dbmigrator类: http:/ /romiller.com/2012/02/09/running-scripting-migrations-from-code/
或者你可以使用migrate.exe这是方便的用于在构建步骤等中运行它们。
https:// msdn .microsoft.com / en-us / data / jj618307.aspx
I'm working in a project that uses EF Code First. I'm trying to use migration features. I don't want to use Package Console Manager. How can I execute the "Add-Migration" and "Update-Database" programmatically?
add-migration TestMigration01 -force
update-database
You have a couple of choices. You can use the dbmigrator class from within your code: http://romiller.com/2012/02/09/running-scripting-migrations-from-code/
Or you can use migrate.exe which is handy for running them in a build step, etc. https://msdn.microsoft.com/en-us/data/jj618307.aspx
这篇关于如何在EntityFramework Codefirst中以编程方式使用迁移?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!