ServiceCollectionHostedServiceExtensions.AddHostedService Método

Definição

Sobrecargas

AddHostedService<THostedService>(IServiceCollection)

Adicione um registro IHostedService para o tipo fornecido.

AddHostedService<THostedService>(IServiceCollection, Func<IServiceProvider,THostedService>)

Adicione um registro IHostedService para o tipo fornecido.

AddHostedService<THostedService>(IServiceCollection)

Adicione um registro IHostedService para o tipo fornecido.

public:
generic <typename THostedService>
 where THostedService : class, Microsoft::Extensions::Hosting::IHostedService[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddHostedService(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddHostedService<THostedService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where THostedService : class, Microsoft.Extensions.Hosting.IHostedService;
static member AddHostedService : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'HostedService : null and 'HostedService :> Microsoft.Extensions.Hosting.IHostedService)
<Extension()>
Public Function AddHostedService(Of THostedService As {Class, IHostedService}) (services As IServiceCollection) As IServiceCollection

Parâmetros de tipo

THostedService

Um IHostedService para registrar.

Parâmetros

services
IServiceCollection

O IServiceCollection com o qual registrar.

Retornos

IServiceCollection

O IServiceCollection original.

Aplica-se a

AddHostedService<THostedService>(IServiceCollection, Func<IServiceProvider,THostedService>)

Adicione um registro IHostedService para o tipo fornecido.

public:
generic <typename THostedService>
 where THostedService : class, Microsoft::Extensions::Hosting::IHostedService[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddHostedService(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Func<IServiceProvider ^, THostedService> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddHostedService<THostedService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<IServiceProvider,THostedService> implementationFactory) where THostedService : class, Microsoft.Extensions.Hosting.IHostedService;
static member AddHostedService : Microsoft.Extensions.DependencyInjection.IServiceCollection * Func<IServiceProvider, 'HostedService (requires 'HostedService : null and 'HostedService :> Microsoft.Extensions.Hosting.IHostedService)> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'HostedService : null and 'HostedService :> Microsoft.Extensions.Hosting.IHostedService)
<Extension()>
Public Function AddHostedService(Of THostedService As {Class, IHostedService}) (services As IServiceCollection, implementationFactory As Func(Of IServiceProvider, THostedService)) As IServiceCollection

Parâmetros de tipo

THostedService

Um IHostedService para registrar.

Parâmetros

services
IServiceCollection

O IServiceCollection com o qual registrar.

implementationFactory
Func<IServiceProvider,THostedService>

Um alocador para criar novas instâncias da implementação de serviço.

Retornos

IServiceCollection

O IServiceCollection original.

Aplica-se a