Hello
I am new to Hangfire and I have a few doubts. In my application I can create contracts. For each contract that I create I will create a Recurring Job:
RecurringJob.AddOrUpdate(() => AutomaticMovementsCreation(contractToCreate.DebitValue, contractId, descriptionId.Result), Cron.Minutely);
The thing is before that action I’m always also initializing the current Job Storage which I think it’s not the best way to do:
JobStorage.Current = new SqlServerStorage(ConfigurationManager.ConnectionStrings[ConfigurationKeys.DbDefaultConnectionName].ConnectionString);
Is there anywhere to initialize the JobStorage only once and injecting him or something like that? I tried to do it in the configuration, but it seems to does not work.
app.UseHangfireDashboard();
app.UseHangfireServer();
JobStorage.Current = new SqlServerStorage(ConfigurationManager.ConnectionStrings[ConfigurationKeys.DbDefaultConnectionName].ConnectionString);