/// <summary> /// Adds a <see cref="SqlHealthCheck"/> to the services. /// </summary> /// <param name="builder">The health check builder</param> /// <param name="properties">The health check properties</param> /// <returns>The builder after changes</returns> /// <exception cref="ArgumentNullException"></exception> public static IHealthCheckBuilder AddSql(this IHealthCheckBuilder builder, SqlHealthCheckProperties properties) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (properties == null) { throw new ArgumentNullException(nameof(properties)); } return(builder.Add( p => new SqlHealthCheck(properties, p.GetService <ILogger <SqlHealthCheck> >()), ServiceLifetime.Singleton)); }
/// <summary> /// Creates a new instance. /// </summary> /// <param name="properties">The health check properties</param> /// <param name="logger">An optional logger instance</param> /// <exception cref="ArgumentNullException"></exception> public SqlHealthCheck(SqlHealthCheckProperties properties, ILogger <SqlHealthCheck> logger = null) : base(properties, logger) { Properties = properties ?? throw new ArgumentNullException(nameof(properties)); }