Table of Contents
API reference

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

builder IHostApplicationBuilder

The host application builder to update.

Returns

IHostApplicationBuilder

The builder for chaining purposes.

Type Parameters

TService

The 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

builder IHostApplicationBuilder

The host application builder to update.

Returns

IHostApplicationBuilder

The builder for chaining purposes.

Type Parameters

TInterface

The service contract exposed from dependency injection.

TService

The 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

builder IHostBuilder

The host builder to update.

Returns

IHostBuilder

The builder for chaining purposes.

Type Parameters

TService

The 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

builder IHostBuilder

The host builder to update.

Returns

IHostBuilder

The builder for chaining purposes.

Type Parameters

TInterface

The service contract exposed from dependency injection.

TService

The hosted Discord service implementation.