Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CrontabSchedulerJob{T}" /> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="crontabProcessorFactory">The crontab processor factory.</param>
        /// <param name="invokeMethodName">Name of the invoke method.</param>
        /// <param name="args">The job arguments.</param>
        /// <exception cref="ArgumentNullException">settings
        /// or
        /// invokeMethodName</exception>
        /// <exception cref="SchedulerInitializationException"></exception>
        /// <exception cref="ArgumentNullException">settings
        /// or
        /// invokeMethodName</exception>
        public CrontabSchedulerJob(ISchedulerJobSettings settings,
                                   ICrontabProcessorFactory crontabProcessorFactory,
                                   string invokeMethodName,
                                   IJobArgs args)
            : base(invokeMethodName, args)
        {
            if (invokeMethodName == null)
            {
                throw new ArgumentNullException(nameof(invokeMethodName));
            }

            Settings = settings ?? throw new ArgumentNullException(nameof(settings));
            _crontabProcessorFactory = crontabProcessorFactory ?? throw new ArgumentNullException(nameof(crontabProcessorFactory));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CrontabServiceJob{T}" /> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="crontabProcessorFactory">The crontab processor factory.</param>
        /// <param name="invokeMethodName">Name of the invoke method.</param>
        /// <exception cref="ArgumentNullException">
        /// settings
        /// or
        /// invokeMethodName
        /// </exception>
        /// <exception cref="ServiceInitializationException"></exception>
        /// <exception cref="ArgumentNullException">settings
        /// or
        /// invokeMethodName</exception>
        public CrontabServiceJob(IServiceJobSettings settings, ICrontabProcessorFactory crontabProcessorFactory, string invokeMethodName = "Run")
            : base(invokeMethodName)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (crontabProcessorFactory == null)
            {
                throw new ArgumentNullException(nameof(crontabProcessorFactory));
            }
            if (invokeMethodName == null)
            {
                throw new ArgumentNullException(nameof(invokeMethodName));
            }

            Settings = settings;
            _crontabProcessorFactory = crontabProcessorFactory;
        }