/// <summary>
        /// Constructor
        /// </summary>
        /// <param name="container">The SimpleInjector container</param>
        public SimpleInjectorJobFactory(
            Container container)
        {
            container.NotNull(nameof(container));

            _container = container;
        }
Esempio n. 2
0
        /// <summary>
        /// Configure the jobs to be scheduled and start the scheduler
        /// </summary>
        /// <param name="container">SimpleInjector container</param>
        /// <param name="configurations">All jobs configurations</param>
        public static void Start(
            Container container,
            params JobConfiguration[] configurations)
        {
            container.NotNull(nameof(container));
            configurations.NotNullOrEmpty(nameof(configurations));

            ThisScheduler = GetDefaultScheduler(container);

            foreach (var configuration in configurations)
                ThisScheduler.ScheduleJob(
                    JobBuilder.Create(configuration.JobType).Build(),
                    configuration.TriggerBuilder().Build());
        }