A way to inject PerformContext into job constructor

Hello!

I was wondering if there is a way of injecting PerformContext not to job method but into constructor of the job class.

Scheduling jobs right now looks like below:

BackgroundJob.Enqueue<ILongRunningJob>(j => j.Run((PerformContext)null, other params));

Windsor does the job and fulfills all other dependencies through the constructor.
Would be nice if a PerformContext could be injected there as well. I’m refactoring a project from background worker to Hangfire and I would like to avoid extending all methods I have to call with another argument.

Cheers
Pawel

I’d like this a lot too. It would be nice to make that available as a service. It gets difficult to explain what the PerformContext is and what it does and why it works to junior devs

1 Like