private static IJobDetail CreateJob(JobMetadata schedule) { var jobType = schedule.JobType; return(JobBuilder .Create(jobType) .WithIdentity(jobType.FullName !) .WithDescription(jobType.Name) .RequestRecovery() .Build()); }
private ITrigger CreateTrigger(JobMetadata schedule) { return(TriggerBuilder .Create() .WithIdentity($"{schedule.JobType.FullName}.trigger") .WithCronSchedule(schedule.CronExpression) // .WithCronSchedule(schedule.CronExpression, // x => x.InTimeZone(TimeZoneInfo.FindSystemTimeZoneById("Asia/Tehran"))) // For Linux OS // .WithCronSchedule(schedule.CronExpression, // x => x.InTimeZone(TimeZoneInfo.FindSystemTimeZoneById("Iran Standard Time"))) // For Windows OS .WithDescription(schedule.CronExpression) .Build()); }