source: FarmatikoServices/Services/SingletonUpdateDataJobFactory.cs@ 472dd7e

Last change on this file since 472dd7e was 472dd7e, checked in by Dimitar Slezenkovski <dslezenkovski@…>, 4 years ago

Fix cron job bug

  • Property mode set to 100644
File size: 817 bytes
Line 
1using Microsoft.Extensions.DependencyInjection;
2using Quartz;
3using Quartz.Spi;
4using System;
5using System.Collections.Generic;
6using System.Text;
7
8namespace FarmatikoServices.Services
9{
10 public class SingletonUpdateDataJobFactory : IJobFactory
11 {
12 private readonly IServiceProvider _serviceProvider;
13 public SingletonUpdateDataJobFactory(IServiceProvider serviceProvider)
14 {
15 _serviceProvider = serviceProvider;
16 }
17
18 public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
19 {
20 using (var scope = _serviceProvider.CreateScope())
21 {
22 return scope.ServiceProvider.GetRequiredService(bundle.JobDetail.JobType) as IJob;
23 }
24
25 }
26
27 public void ReturnJob(IJob job) { }
28 }
29}
Note: See TracBrowser for help on using the repository browser.