标签:传递 sync OLE contex get div 参数 class quartz
1.jobDetail
//添加 //Key:Value jobDetail.JobDataMap.Add("张翼德", "张翼德"); jobDetail.JobDataMap.Add("year",2019);
取值
public class HelloJob : IJob { public async Task Execute(IJobExecutionContext context) { await Task.Run(() => {
//这里 string name = context.JobDetail.JobDataMap.GetString("张翼德"); int year = context.JobDetail.JobDataMap.GetInt("year"); Console.WriteLine($@"JobDetail{name}" + DateTime.Now + ""); Console.WriteLine("JobDetail 当前年份" + year); }); } }
2.Trigger
//添加 //Key:Value trigger.JobDataMap.Add("刘玄德", "刘玄德"); trigger.JobDataMap.Add("year", "2020");
取值
public class HelloJob : IJob { public async Task Execute(IJobExecutionContext context) { await Task.Run(() => {
//这里 string name2 = context.Trigger.JobDataMap.GetString("刘玄德");int year2 = context.Trigger.JobDataMap.GetInt("year"); Console.WriteLine($@"Trigger{name2}" + DateTime.Now + ""); Console.WriteLine("Trigger 当前年份" + year2); }); } }
3.MergedJobDataMap
同样的name,取的是后一个的值
int year3= context.MergedJobDataMap.GetInt("year");
标签:传递 sync OLE contex get div 参数 class quartz
原文地址:https://www.cnblogs.com/mi21/p/12090299.html