// 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 System;
using Microsoft.AspNet.Diagnostics.Elm;
namespace Microsoft.Extensions.DependencyInjection
{
public static class ElmServiceCollectionExtensions
{
///
/// Registers an and configures default .
///
public static IServiceCollection AddElm(this IServiceCollection services)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
services.AddOptions();
services.AddSingleton();
return services;
}
///
/// Configures a set of for the application.
///
/// The services available in the application.
/// The which need to be configured.
public static void ConfigureElm(
this IServiceCollection services,
Action configureOptions)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
if (configureOptions == null)
{
throw new ArgumentNullException(nameof(configureOptions));
}
services.Configure(configureOptions);
}
}
}