How can I configure Quartz in .net core to use dependency injection? I using standard .net core Dependency mechanism. In constructor of class that implements IJob, I need inject some dependencies.
C# – .net Core Quartz Dependency Injection
asp.net-corecdependency-injectionnetquartz.net
Related Topic
- .net – Difference between decimal, float and double in .NET
- What’s the difference between the Dependency Injection and Service Locator patterns
- Inversion of Control vs Dependency Injection
- Why does one use dependency injection
- C# – Resolving instances with ASP.NET Core DI from within ConfigureServices
- C# – ASP.NET Core Dependency Injection error: Unable to resolve service for type while attempting to activate
- .net – the difference between .NET Core and .NET Standard Class Library project types
Best Answer
You can use the
Quartz.Spi.IJobFactory
interface and implement it. The Quartz documentations states:Edit
The implementation can look like this:
To use it with the
Microsoft.Extensions.DependencyInjection
create your container like this:References
Quartz documentation
Api