Пример #1
0
        /// <summary>
        /// Configures the schedule to run a job resolved using a specified closure.
        /// </summary>
        /// <param name="jobCallback">A method to create the <see cref="ICronJob"/> to be executed in the schedule.</param>
        /// <returns>A part that allows chained fluent method calls.</returns>
        public JobPart Run(Func <ICronJob> jobCallback)
        {
            JobExecutionWrapper executionWrapper = (a) =>
            {
                using (var job = jobCallback())
                {
                    a(job);
                }
            };

            var entry = _service.AddScheduledJob(_schedule, executionWrapper);

            return(new JobPart(_service, entry));
        }