313
CHAPTER 7 | Implement resilient applications
SqlConnectionHealthCheck
is a custom class that
implements
IHealthCheck
, which takes a
connection string as a constructor parameter and executes a simple query to check if
the connection
to the SQL database is successful. It returns
HealthCheckResult.Healthy()
if
the query was executed
successfully and a
FailureStatus
with the actual exception when it fails.
// Sample SQL Connection Health Check
Dostları ilə paylaş: