Support for hosted services
Closed this issue · 1 comments
fleed commented
Does it support registration of IHostedService
and BackgroundService
instances?
pwelter34 commented
Yes it does. You just have to make sure that one of the Service Types is IHostedService
and that duplicates are supported. If you look at what AddHostedService
actually does, it just registers the services as a singleton with service type IHostedService
[RegisterSingleton(Duplicate = DuplicateStrategy.Append)]
public class HostedService : IHostedService{ }
OR
[RegisterSingleton(ServiceType = typeof(IHostedService), Duplicate = DuplicateStrategy.Append)]
public class HostedService : BackgroundService{ }