source: FarmatikoServices/Services/SingletonUpdateDataJobFactory.cs@ f554983

Last change on this file since f554983 was f554983, checked in by Dimitar Slezenkovski <dslezenkovski@…>, 18 months ago

Add cron job for updating data, with Quartz.NET

  • Property mode set to 100644
File size: 704 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 return _serviceProvider.GetRequiredService(bundle.JobDetail.JobType) as IJob;
21 }
22
23 public void ReturnJob(IJob job) { }
24 }
25}
Note: See TracBrowser for help on using the repository browser.