Is it possible to register a quartz job to always use the same IJob instance introduced by the Unity DI container? I have one instance of the “monitor” class Monitor , coming from Unity DI, which I registered as:
container.RegisterType<IMonitor, Monitor>(new ContainerControlledLifetimeManager())
and my IJob implementation assumes an instance of this monitor is injected into it:
class MyJob : IJob { ... [Dependency] IMonitor monitor {get; set;} ... void Execute() ... }
but when an event of quartz events occurs, the implementation of IJob.Execute() is called before the dependency is introduced. How do I make this work? Should I consider other DI containers or schedulers instead?
thanks
source share