Exemplo n.º 1
0
        /// <summary>
        /// Adds a <see cref="HttpHealthCheck"/> 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 AddHttp(this IHealthCheckBuilder builder, HttpHealthCheckProperties properties)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            return(builder.Add(
                       p => new HttpHealthCheck(properties, p.GetService <ILogger <HttpHealthCheck> >()),
                       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 HttpHealthCheck(HttpHealthCheckProperties properties, ILogger <HttpHealthCheck> logger = null)
     : base(properties, logger)
 {
     Properties = properties ?? throw new ArgumentNullException(nameof(properties));
 }