I have this code which can be used to check the database health using C# in NET 6.
Version 1:
var hcBuilder = builder.Services.AddHealthChecks();
hcBuilder.AddSqlServer(myServicesConnStr);
Version 2:
builder.Services.AddHealthChecks()
.AddDbContextCheck<MyServicesContext>();
What is the difference between version 1 and version 2 in regards to checking the health of the database using HealthCheck package? Is there any difference in its efficiency?
Version 1. from AspNetCore.HealthChecks.SqlServer : It is not maintained or supported by Microsoft.
Version 2. from Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore : It is maintained and supported by Microsoft.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With