private readonly IScheduler scheduler;
//scheduler = StdSchedulerFactory.GetDefaultScheduler().GetAwaiter().GetResult();
//非静态使用
scheduler = _serviceProvider.GetService(typeof(IScheduler)) as IScheduler;
//依赖注入
IServiceCollection services = new ServiceCollection();
services.AddScoped<IJobFactory, JobFactory>();
//非静态使用Scheduler
services.AddSingleton(service =>
{
var scheduler = StdSchedulerFactory.GetDefaultScheduler().Result;
scheduler.JobFactory = service.GetService<IJobFactory>();
return scheduler;
});