You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
688 B
C#
28 lines
688 B
C#
using Quartz.Spi;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Quartz.NET.Web.Utility
|
|
{
|
|
public class IOCJobFactory: IJobFactory
|
|
{
|
|
private readonly IServiceProvider _serviceProvider;
|
|
public IOCJobFactory(IServiceProvider serviceProvider)
|
|
{
|
|
_serviceProvider = serviceProvider;
|
|
}
|
|
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
|
|
{
|
|
return _serviceProvider.GetService(bundle.JobDetail.JobType) as IJob;
|
|
|
|
}
|
|
|
|
public void ReturnJob(IJob job)
|
|
{
|
|
(job as IDisposable)?.Dispose();
|
|
}
|
|
}
|
|
}
|