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 | |
---|
1 | using Microsoft.Extensions.DependencyInjection;
|
---|
2 | using Quartz;
|
---|
3 | using Quartz.Spi;
|
---|
4 | using System;
|
---|
5 | using System.Collections.Generic;
|
---|
6 | using System.Text;
|
---|
7 |
|
---|
8 | namespace 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.