csharp.libraries.generichost.IHostBuilderExtensions.mustache Maven / Gradle / Ivy
{{>partial_header}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using {{packageName}}.{{clientPackage}};
namespace {{packageName}}.Extensions
{
///
/// Extension methods for IHostBuilder
///
{{>visibility}} static class IHostBuilderExtensions
{
{{^hasAuthMethods}}
///
/// Add the api to your host builder.
///
///
public static IHostBuilder Configure{{apiName}}(this IHostBuilder builder)
{
builder.ConfigureServices((context, services) =>
{
HostConfiguration config = new HostConfiguration(services);
IServiceCollectionExtensions.Add{{apiName}}(services, config);
});
return builder;
}
{{/hasAuthMethods}}
///
/// Add the api to your host builder.
///
///
///
public static IHostBuilder Configure{{apiName}}(this IHostBuilder builder, Action options)
{
builder.ConfigureServices((context, services) =>
{
HostConfiguration config = new HostConfiguration(services);
options(context, services, config);
IServiceCollectionExtensions.Add{{apiName}}(services, config);
});
return builder;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy