More than one migrations configuration type was found in the assembly ''. Specify the name of the one to use. On add-migration

好久不见. 提交于 2020-01-23 05:34:24

问题


In Package Manager Console, I'm trying to update my database. When I enter this command :

add-migration Migration1

And I get this :

More than one migrations configuration type was found in the assembly 'MyProject.POCO'. Specify the name of the one to use.

I googled the error and I get this :

add-migration InitialBSchema -IgnoreChanges -ConfigurationTypeName
ConfigurationB -ProjectName ProjectContextIsInIfNotMainOne
-StartupProjectName NameOfMainProject  -ConnectionStringName ContextB

But I don't know how to apply this to my project. What should I write for ConfigurationTypeName? Or is there a simpler way to do this? Thanks.


回答1:


You have multiple DbContext in your project you will need to indicate which is going to have the database update. This can be done with -ConfigurationTypeName. The ConfigurationTypeName is the name of your Configuration class in your migration folder.

Add-Migration -Name Migration1 -ConfigurationTypeName MyProject.POCO.Configuration

You can read more about it here.



来源:https://stackoverflow.com/questions/41355633/more-than-one-migrations-configuration-type-was-found-in-the-assembly-specif

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