What's the purpose of StartupProjectName parameter in Add-Migration in EF

半世苍凉 提交于 2019-12-11 04:11:58

问题


As I understand what Add-Migration is doing, it's just compares the current model of code with the model of last applied migration (which has the entire model in its resx file)

For the description of StartupProjectName paramter it says:

-StartUpProjectName

Specifies the configuration file to use for named connection strings. If omitted, the specified project’s configuration file is used.

If each migration has a snapshot of whole model, then there would no need to have a database, since the current model and that snapshot are totally comparable.

So why is this parameter provided in Add-Migration command to specify a connection string?


回答1:


With that parameter you can specify the project which contains your connection string (in app.config e.g.).

You can have your migrations in a seperate project (which doesn't contain the connection string).




回答2:


Add-Migration does not require "-StartUpProjectName" since you can choose the "default project" from the drop list above the package-manager console. You can override the "default project" value from the drop list by using the parameter "-StartUpProjectName"



来源:https://stackoverflow.com/questions/31267974/whats-the-purpose-of-startupprojectname-parameter-in-add-migration-in-ef

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!