This service I am working on has two service types, lets call them A and B.
I know I could start both services within the same .exe by doing
IHostedService.AddHostedService<A>();
IHostedService.AddHostedService<B>();
But I want to keep the services working separately. Is there any way to call AddHostedService dynamically? I mean getting the service type via the appsettings, and doing something like this. I am simplifying the code, but imagine I am getting the string A from the appsettings:
var type = Type.GetType("A");
IHostedService.AddHostedService<Type>();