26 строки
725 B
C#
26 строки
725 B
C#
using System.Data.Common;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace HealthChecksSample
|
|
{
|
|
public class SqlConnectionHealthCheck : DbConnectionHealthCheck
|
|
{
|
|
private static readonly string DefaultTestQuery = "Select 1";
|
|
|
|
public SqlConnectionHealthCheck(string connectionString)
|
|
: this(connectionString, testQuery: DefaultTestQuery)
|
|
{
|
|
}
|
|
|
|
public SqlConnectionHealthCheck(string connectionString, string testQuery)
|
|
: base(connectionString, testQuery ?? DefaultTestQuery)
|
|
{
|
|
}
|
|
|
|
protected override DbConnection CreateConnection(string connectionString)
|
|
{
|
|
return new SqlConnection(connectionString);
|
|
}
|
|
}
|
|
}
|