CSharpEssentials.EntityFrameworkCore.HealthChecks
9.0.0
dotnet add package CSharpEssentials.EntityFrameworkCore.HealthChecks --version 9.0.0
NuGet\Install-Package CSharpEssentials.EntityFrameworkCore.HealthChecks -Version 9.0.0
<PackageReference Include="CSharpEssentials.EntityFrameworkCore.HealthChecks" Version="9.0.0" />
<PackageVersion Include="CSharpEssentials.EntityFrameworkCore.HealthChecks" Version="9.0.0" />
<PackageReference Include="CSharpEssentials.EntityFrameworkCore.HealthChecks" />
paket add CSharpEssentials.EntityFrameworkCore.HealthChecks --version 9.0.0
#r "nuget: CSharpEssentials.EntityFrameworkCore.HealthChecks, 9.0.0"
#:package CSharpEssentials.EntityFrameworkCore.HealthChecks@9.0.0
#addin nuget:?package=CSharpEssentials.EntityFrameworkCore.HealthChecks&version=9.0.0
#tool nuget:?package=CSharpEssentials.EntityFrameworkCore.HealthChecks&version=9.0.0
CSharpEssentials.EntityFrameworkCore.HealthChecks
A readiness health check for EF Core. It reports Unhealthy while a DbContext has migrations that are not applied, so /health/ready keeps traffic away from an instance whose database schema is behind its code.
It is a separate package because it depends on Microsoft.Extensions.Diagnostics.HealthChecks, which CSharpEssentials.EntityFrameworkCore does not.
Install
dotnet add package CSharpEssentials.EntityFrameworkCore.HealthChecks
Targets net10.0, net9.0 and net8.0, each on the EF Core major of CSharpEssentials.EntityFrameworkCore.
Usage
using CSharpEssentials.EntityFrameworkCore.HealthChecks;
builder.Services.AddDbContext<AppDbContext>(options => options.UseNpgsql(connectionString));
builder.Services.AddHealthChecks()
.AddMigrationsCheck<AppDbContext>(); // name "AppDbContext-migrations", tag "ready"
app.MapHealthChecks("/health/ready", new HealthCheckOptions
{
Predicate = check => check.Tags.Contains(MigrationsHealthCheckBuilderExtensions.ReadyTag),
});
| Member | What it does |
|---|---|
AddMigrationsCheck<TContext>(name?, failureStatus?, tags?, timeout?) |
Adds the check. name defaults to "{TContext}-migrations", tags to ["ready"], failureStatus to Unhealthy |
DbContextMigrationsHealthCheck<TContext> |
Calls Database.GetPendingMigrationsAsync() on a context from the health check scope. Pending migrations: the failure status, with the names under the pendingMigrations data key. All applied but Database.HasPendingModelChanges() is true (the model changed and no migration covers it): Degraded. Otherwise Healthy |
MigrationsHealthCheckBuilderExtensions.ReadyTag |
"ready" |
A database that does not exist yet has every migration pending. When the database cannot be reached, the query throws and the health check service reports the failure status with the exception. Either way the check fails, so it also covers connectivity.
To apply the migrations at startup instead of waiting for them, use MigrateDatabaseAsync<TContext>() from CSharpEssentials.EntityFrameworkCore (see Migrate on startup).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- CSharpEssentials.EntityFrameworkCore (>= 9.0.0)
- Microsoft.EntityFrameworkCore (>= 10.0.1 && < 11.0.0)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.1 && < 11.0.0)
- Microsoft.Extensions.Caching.Abstractions (>= 10.0.1)
- Microsoft.Extensions.Caching.Memory (>= 10.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.1)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.1)
- Microsoft.Extensions.Options (>= 10.0.1)
-
net8.0
- CSharpEssentials.EntityFrameworkCore (>= 9.0.0)
- Microsoft.Bcl.TimeProvider (>= 8.0.0)
- Microsoft.EntityFrameworkCore (>= 8.0.0 && < 9.0.0)
- Microsoft.EntityFrameworkCore.Relational (>= 8.0.0 && < 9.0.0)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Caching.Memory (>= 9.0.4)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Options (>= 9.0.4)
- System.Text.Json (>= 9.0.4)
-
net9.0
- CSharpEssentials.EntityFrameworkCore (>= 9.0.0)
- Microsoft.EntityFrameworkCore (>= 9.0.4 && < 10.0.0)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.4 && < 10.0.0)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Caching.Memory (>= 9.0.4)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Options (>= 9.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 9.0.0 | 0 | 11/28/2026 |