Reputation: 33
I am building an ASP.NET MVC application, and when add In the Package Manager Console (PMC), enter the following commands:
Add-Migration InitialCreate
Update-Database
I got this error:
More than one DbContext was found. Specify which one to use. Use the '-Context' parameter for PowerShell commands and the '--context' parameter for dotnet commands.
This is my code:
Upvotes: 2
Views: 6231
Reputation: 1
PM> Add-Migration AdditionalFields More than one DbContext was found. Specify which one to use. Use the '-Context' parameter for PowerShell commands and the '--context' parameter for dotnet commands.
Upvotes: 0
Reputation: 36645
More than one DbContext was found. Specify which one to use. Use the '-Context' parameter for PowerShell commands and the '--context' parameter for dotnet commands.
This error means there are several classes that have been inherited from DbContext class. So add migration with:
Add-Migration InitialCreate -context MvcWatchesContext.
Upvotes: 3