To handle background and recurring tasks on our app we’re using Quartz.net running in the background.
We have a quartz IJobListener that starts a child container and autowires the job instance dependencies, in a similar fashion to service instances.
We want to have the same IoC registrations for code running on the quartz threads that we have for our services.
When using a ReuseScope of Request, we want a new dependency instance per job instance, the same way an http request has new instances. For request scope the instances are stored on RequestContext.Instance.Items, which are cleared on RequestContext.Instance.EndRequest()
Would it be correct to just call EndRequest when the job is finished to clear that scope? That wouldn’t call .Dispose() on IDisposables, or would it?
Sorry, I might have mispoken. I don’t want to share RequestScope instances, just their wiring on funq.
I think of RequestScope as a unit of work, and I want to consider a quartz job to be like a request in that way. All our background work runs in a job, so that makes it easier to reason about (job == request). Thanks