internal static CommonSchedulerTaskProperties GetJobProperties <T>(IConfigurationSection rootSection) where T : IJob { var jobName = typeof(T).Name; var jobProperties = new CommonSchedulerTaskProperties(); var jobSection = rootSection.GetSection(jobName); jobSection.Bind(jobProperties); return(string.IsNullOrEmpty(jobProperties.Schedule) ? null : jobProperties); }
public static IServiceCollectionQuartzConfigurator RegisterJob <TJob>(this IServiceCollectionQuartzConfigurator configurator, CommonSchedulerTaskProperties taskSettings) where TJob : class, IJob { var jobType = typeof(TJob); configurator.ScheduleJob <TJob>( trigger => trigger.WithIdentity(QuartzService.GetJobTriggerIdentity(jobType)) .WithDescription(QuartzService.GetJobTriggerDescription(jobType, taskSettings.Schedule)) .WithCronSchedule(taskSettings.Schedule), j => { j .WithIdentity(jobType.Name) .WithDescription(QuartzService.GetJobDescription(jobType, taskSettings.Description)); if (taskSettings.SpecifiedConditions != null) { j.UsingJobData(new JobDataMap(taskSettings.SpecifiedConditions)); } }); return(configurator); }