Innofactor.QuartzAspNet by Innofactor

<PackageReference Include="Innofactor.QuartzAspNet" Version="1.14.0" />

 ScopedJob

class ScopedJob : IJob
Scoped wrapper for jobs.
using Microsoft.Extensions.DependencyInjection; using Quartz; using System.Threading.Tasks; namespace Innofactor.QuartzAspNet { internal class ScopedJob { private IJob actualJob; private IServiceScope scope; public ScopedJob(IJob actualJob, IServiceScope scope) { this.actualJob = actualJob; this.scope = scope; } public async Task Execute(IJobExecutionContext context) { await actualJob.Execute(context); scope.Dispose(); } } }