- What is your product version? 10.1 RC
- What is your product type (Angular or MVC)? MVC
- What is product framework type (.net framework or .net core)? Net 5
I've just started to test version 10.1 RC. I'm following the getting started guide.
I set the Default Project in the Package Manager Console to EntityFrameworkCore.
I've got as far as running update-database but it fails with "More than one DbContext was found".
6 Answer(s)
-
0
Hi @Mitch
Thanks, we will check this.
-
0
Hi @Mitch I checked that but could not reproduce the problem. Did you enable healtchecks? And can you please run
dotnet ef dbcontext list
command and share the result? -
0
Hi @musa.demir
I hadn't enabled Health Checks myself, it seems they are Enabled by default in the appsettings.json file.
"HealthChecks": { "HealthChecksEnabled": true, "HealthChecksUI": { "HealthChecksUIEnabled": true, "HealthChecks": [ { "Name": "xxxxxxx.Web.MVC", "Uri": "https://localhost:44302/health" } ], "EvaluationTimeOnSeconds": 10, "MinimumSecondsBetweenFailureNotifications": 60 } },
As an experiment, I tried setting "HealthchecksEnabled" to false and as a result the issue with "More than one DbContext found" went away. So the issue is resolved as long as the HealthChecks are not Enabled.
-
0
try Update-database -context "{Context calss name}"
-
0
@samara081 Thanks for the tip.
My point was that the Getting Started Guide just says to use "update-database" which is now incorrect as it no longer works with HeathChecksEnabled by default.
-
0
Hi @Mitch
You are right, HeathChecksEnabled must be false by default. We will check this, thanks. I have created an issue https://github.com/aspnetzero/aspnet-zero-core/issues/3668