addHostedService<THostedService extends HostedService> method

ServiceCollection addHostedService<THostedService extends HostedService>(
  1. ImplementationFactory implementationFactory
)

Add an HostedService registration for the given type.

Implementation

ServiceCollection addHostedService<THostedService extends HostedService>(
  ImplementationFactory implementationFactory,
) {
  tryAddIterable(
    ServiceDescriptor.singleton<HostedService>(
      implementationFactory,
    ),
  );

  return this;
}