private JobDataMap GetJobDataMap <T, D>(D data, string uniqueKey) where T : IBlackPearlJob <D> where D : class, new() { JobDataMap jobDataMap = (data != null) ? mapper.Map(data) : new JobDataMap(); jobDataMap.Add(UniqueSchedulingKey, uniqueKey); jobDataMap.Add(JobType, typeof(T)); return(jobDataMap); }
public async Task Execute(IJobExecutionContext context) { try { T data = (context.MergedJobDataMap?.Keys?.Any() == true) ? mapper.Map <T>(context.MergedJobDataMap) : default(T); await JobToExecute.Execute(data); } catch { } }