Exemple #1
0
        /// <summary>
        /// Adds services required for health check.
        /// </summary>
        /// <param name="services">The services collection</param>
        /// <param name="builder">The configuration builder</param>
        /// <returns>The service collection after changes</returns>
        public static IServiceCollection AddHealthCheck(this IServiceCollection services, Action <IHealthCheckBuilder> builder)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            var cfg = new HealthCheckBuilder();

            builder(cfg);

            cfg.RegisterDescriptors(services);

            return(services);
        }