8

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.

jason
  • 6,962
  • 36
  • 117
  • 198

1 Answers1

15

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.

Ahmar
  • 3,717
  • 2
  • 24
  • 42