public async Task <HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default) { try { using (var connection = new TaosConnection(_connectionString)) { await connection.OpenAsync(cancellationToken); using (var command = connection.CreateCommand()) { command.CommandText = _sql; var result = await command.ExecuteScalarAsync(cancellationToken); if (_sql == TaosHealthCheckBuilderExtensions.HEALTH_QUERY) { var _result = Convert.ToInt32(result); if (_result != 1) { return(new HealthCheckResult(context.Registration.FailureStatus, description: $"Server status:{_result}")); } } } return(HealthCheckResult.Healthy()); } } catch (Exception ex) { return(new HealthCheckResult(context.Registration.FailureStatus, exception: ex)); } }