I am here to request support for registering multiple instances of the same service, i.e. instead of creating one class for each Cron Expression, as mentioned in your original post, it is desirable to register as indicated by the code below
However, the main problem lies in the configurations.
The classes are registered ok as singletons, but they only read the latest registered configuration.
How can we ensure that each instance has the current registered configuration?
Any help would be appreciated.
Kind regards,
Paulo
Hello,
I am here to request support for registering multiple instances of the same service, i.e. instead of creating one class for each Cron Expression, as mentioned in your original post, it is desirable to register as indicated by the code below
appsettings.json or equivalent
Startup.cs class or equivalent
As per Microsoft's recommendation, which you may read here, instead of calling
services.AddHostedService<TCronService>();
We would register each instance using
However, the main problem lies in the configurations. The classes are registered ok as singletons, but they only read the latest registered configuration. How can we ensure that each instance has the current registered configuration?
Any help would be appreciated. Kind regards, Paulo