More than one type of migration configuration was found in the assembly. Indicate the name used. When adding migration

In the package manager console, I am trying to update my database. When I enter this command:

add-migration Migration1 

And I get this:

More than one type of migration configuration 'MyProject.POCO was found in the assembly. Indicate the name used.

I was looking for an error and I realized:

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

But I do not know how to apply this to my project. What should I write for ConfigurationTypeName? Or is there an easier way to do this? Thanks.

+7
source share
2 answers

You have several DbContext in your project, you will need to specify what the database update will have. This can be done using -ConfigurationTypeName . The name ConfigurationTypeName is the name of your configuration class in the migration folder.

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

You can find out more about this.

+12
source

Ahmar took the answer and used this command in the package manager console. It worked well for me.

Add-Migration -Name initial -IgnoreChanges -ConfigurationTypeName Configuration

0
source

Source: https://habr.com/ru/post/1261972/


All Articles