Open
Description
Is your feature request related to a problem? Please describe.
Right now adding multiple different checks using the same DbContext type will result in some of them being failed, because the DbContext might already be disposed.
Default Lifetime of DbContext is scoped, it would be a shame to have to change that to transient for HealthChecks to work properly in this scenarop.
Describe the solution you'd like
Please change or add options to configure this behavior to run every healthcheck in its own scope,
Additional context
working repro here:
https://github.com/ThomasBergholdWieser/healthchecksrepro
Just execute the /health endpoint a few times, it should happen pretty often. Change the Lifetime to Transient to make it work.