src/Orleans.Core/Configuration/OptionLogger/OptionFormatterExtensionMethods.cs
/// <summary>
/// Configures an options formatter for <typeparamref name="TOptions"/>.
/// </summary>
/// <param name="services">
/// The services.
/// </param>
/// <typeparam name="TOptions">
/// The options type.
/// </typeparam>
/// <typeparam name="TOptionFormatter">
/// The option formatter type.
/// </typeparam>
/// <returns>
/// The <see cref="IServiceCollection"/>, for chaining with other calls.
/// </returns>
Configures an options formatter for .
Configures an options formatter for .
public static IServiceCollection ConfigureFormatter<TOptions, TOptionFormatter>(this IServiceCollection services)
            where TOptions : class
            where TOptionFormatter : class, IOptionFormatter<TOptions>
        {
            if (services.All(service => service.ServiceType != typeof(IOptionFormatter<TOptions>)))
            {
                services
                    .AddSingleton<IOptionFormatter<TOptions>, TOptionFormatter>()
                    .AddFromExisting<IOptionFormatter, IOptionFormatter<TOptions>>();
            }
            else
            {
                services.AddSingleton<IOptionFormatter<TOptions>, TOptionFormatter>();
            }
            return services;
        }
public static IServiceCollection ConfigureFormatter < TOptions , TOptionFormatter > ( this IServiceCollection services ) where TOptions : class where TOptionFormatter : class , IOptionFormatter < TOptions > { if ( services . All ( service => service . ServiceType != typeof ( IOptionFormatter < TOptions > ) ) ) { services . AddSingleton < IOptionFormatter < TOptions > , TOptionFormatter > ( ) . AddFromExisting < IOptionFormatter , IOptionFormatter < TOptions > > ( ) ; } else { services . AddSingleton < IOptionFormatter < TOptions > , TOptionFormatter > ( ) ; } return services ; }
Configures an options formatter for .
Configures an options formatter for .
// override IOptionFormatter<TOptions>
The , for chaining with other calls.
The for chaining with other calls .
IServiceCollection
this
services
None
typeparam
The options type.
The options type .
typeparam
The option formatter type.
The option formatter type .