问题
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