void Delay(DateTime start, object[] paramers) { if (start < DateTime.Now) { throw (new Exception("任务启动时间设置失败")); } var delay = start - DateTime.Now; BackgroundJob.Schedule(() => JobInvoke.Invoke(TheDomain.BasePath, TheAssembly.FullName, TheJob.FullName, paramers), delay); }
void Schedule(DateTime start, int period, object[] paramers) { if (start < DateTime.Now) { throw (new Exception("任务启动时间设置失败")); } if (JobCornSetting.Dictionary.Contains(period) == false) { throw (new Exception("任务周期设置设置失败")); } RecurringJob.AddOrUpdate(() => JobInvoke.Invoke(TheDomain.BasePath, TheAssembly.FullName, TheJob.FullName, paramers), Cron.MinuteInterval(period)); }
void Immediately(object[] paramers) { BackgroundJob.Enqueue(() => JobInvoke.Invoke(TheDomain.BasePath, TheAssembly.FullName, TheJob.FullName, paramers)); }