Method AddDiscordHostedService
- Namespace
- DisCatSharp.Hosting.DependencyInjection
- Assembly
- DisCatSharp.Hosting.DependencyInjection.dll
AddDiscordHostedService<TService>(IHostApplicationBuilder)
Adds your bot as a background service to the host application builder.
public static IHostApplicationBuilder AddDiscordHostedService<TService>(this IHostApplicationBuilder builder) where TService : class, IDiscordHostedService
Parameters
builderIHostApplicationBuilderThe host application builder to update.
Returns
- IHostApplicationBuilder
The
builderfor chaining purposes.
Type Parameters
TServiceThe hosted Discord service implementation.
AddDiscordHostedService<TInterface, TService>(IHostApplicationBuilder)
Adds a Discord background service that can also be resolved via TInterface to the host application builder.
public static IHostApplicationBuilder AddDiscordHostedService<TInterface, TService>(this IHostApplicationBuilder builder) where TInterface : class, IDiscordHostedService where TService : class, TInterface, IDiscordHostedService
Parameters
builderIHostApplicationBuilderThe host application builder to update.
Returns
- IHostApplicationBuilder
The
builderfor chaining purposes.
Type Parameters
TInterfaceThe service contract exposed from dependency injection.
TServiceThe hosted Discord service implementation.
AddDiscordHostedService<TService>(IHostBuilder)
Adds your bot as a background service to the host builder.
public static IHostBuilder AddDiscordHostedService<TService>(this IHostBuilder builder) where TService : class, IDiscordHostedService
Parameters
builderIHostBuilderThe host builder to update.
Returns
- IHostBuilder
The
builderfor chaining purposes.
Type Parameters
TServiceThe hosted Discord service implementation.
AddDiscordHostedService<TInterface, TService>(IHostBuilder)
Adds a Discord background service that can also be resolved via TInterface to the host builder.
public static IHostBuilder AddDiscordHostedService<TInterface, TService>(this IHostBuilder builder) where TInterface : class, IDiscordHostedService where TService : class, TInterface, IDiscordHostedService
Parameters
builderIHostBuilderThe host builder to update.
Returns
- IHostBuilder
The
builderfor chaining purposes.
Type Parameters
TInterfaceThe service contract exposed from dependency injection.
TServiceThe hosted Discord service implementation.