In ASP.NET Core-6 Web API, I have two DBContexts:
For add-migration, I used these two in the PM :
The two add-migration works.
However, for the update-database when I did:
update-database -verbose
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 do.net commands
How do I resolve this?
Thank you
If you are using Visual Studio's Package Manager Console
with reference to Microsoft.EntityFrameworkCore.Tools
, then you can execute the following command:
PM> Update-Database -context your_context -v
If you use do.net
command, then try this:
dotnet ef database update --context your_context
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.