我正在尝试使用quartzt.net内核,但是DI有一个大问题。我想使用.net核心中的“构造函数DI”,默认情况下不支持。
是否可以以某种方式扩展QuartzJonFactory以支持默认的核心Constructor DI?
我想要的例子
public class BookCleanUpServiceJob : IJob
{
private readonly BookCleanUpService _bookCleanUpService;
private readonly CancellationToken _cancellationToken;
private readonly ILogger _logger;
public OrderBookCleanUpServiceJob(BookCleanUpServicebookCleanUpService, CancellationToken cancellationToken, ILogger logger)
{
_bookCleanUpService = bookCleanUpService;
_cancellationToken = cancellationToken;
_logger = logger;
}
public async Task Execute(IJobExecutionContext context)
{
_logger.Info("Executing bookCleanUpServiceJob at: " + DateTime.UtcNow);
await Task.Run(() => _bookCleanUpService.Perform(), _cancellationToken);
}
}