I have a service class that has a method like
public void BackgroundJob(string cronrule)
{
RecurringJob.AddOrUpdate("somejob", () => FetchCallHistoryAsync(), cronrule);
}
I want to put start the job in the startup, something like this
public void ConfigureServices(IServiceCollection services)
{
...
new MyClass().BackgroundJob("10 * * * *")
}
But my class depends on several other services, I don't know how to instantiate it from Startup.cs, any idea?