Exemple #1
0
 /// <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 DelegatingHealthCheck(DelegatingHealthCheckProperties properties, ILogger <DelegatingHealthCheck> logger = null)
     : base(properties, logger)
 {
     Properties = properties ?? throw new ArgumentNullException(nameof(properties));
 }
Exemple #2
0
        /// <summary>
        /// Adds a <see cref="DelegatingHealthCheck"/> 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 AddDelegate(this IHealthCheckBuilder builder, DelegatingHealthCheckProperties properties)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            return(builder.Add(
                       p => new DelegatingHealthCheck(properties, p.GetService <ILogger <DelegatingHealthCheck> >()),
                       ServiceLifetime.Singleton));
        }