// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting;
namespace Microsoft.Extensions.DependencyInjection
{
///
/// Provides extension methods for registering in an .
///
public static class HealthCheckServiceCollectionExtensions
{
///
/// Adds the to the container, using the provided delegate to register
/// health checks.
///
///
/// This operation is idempotent - multiple invocations will still only result in a single
/// instance in the . It can be invoked
/// multiple times in order to get access to the in multiple places.
///
/// The to add the to.
/// An instance of from which health checks can be registered.
public static IHealthChecksBuilder AddHealthChecks(this IServiceCollection services)
{
services.TryAddSingleton();
services.TryAddSingleton();
return new HealthChecksBuilder(services);
}
}
}