コード例 #1
0
        public JobSchedule(Type jobType, string cronExpression)
        {
            var asd = new DummyJob();

            JobType        = jobType;
            CronExpression = cronExpression;
        }
コード例 #2
0
        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
        {
            IJob job;

            // https://stackoverflow.com/a/32315573/7032856
            try
            {
                job = _serviceProvider.GetRequiredService(bundle.JobDetail.JobType) as IJob;
            }
            catch (Exception ex)
            {
                const string message = "Exception creating job. Giving up and returning a do-nothing logging job.";
                Console.WriteLine(message);
                while (ex.InnerException != null)
                {
                    ex = ex.InnerException;
                }
                Console.WriteLine(JsonSerializer.Serialize(ex));
                job = new DummyJob();
            }
            return(job);
        }