Пример #1
0
        /// <summary>
        /// Starts this instance.
        /// </summary>
        public override void Start()
        {
            using (var transaction = uow.BeginTransaction())
            {
                // Create the instance ID for this element
                instance = engineRepository.CreateNewInstance();

                // Set the execution begin time
                instance.BeginTime = DateTime.Now;

                // Add current instance to entry
                jobEntry.Instances.Add(instance);
            }

            // Add a message to notify the element started
            AddMessage("Job execution started.");

            // Creating the engine tasks flow
            var engineTasksFlow = new List <IEngineTask>();

            foreach (var taskEntry in jobEntry.Tasks)
            {
                var engineTask = serviceProvider.GetService <IEngineTask>();
                engineTask.LoadFromEntity(taskEntry.Id);
                engineTasksFlow.Add(engineTask);
            }

            foreach (var engineTask in engineTasksFlow)
            {
                engine.ExecuteTask(engineTask);
            }
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EngineElement"/> class.
        /// </summary>
        /// <param name="uow">The uow.</param>
        /// <param name="enginRepo">The engin repo.</param>
        /// <param name="logger">The logger.</param>
        /// <param name="messageService">The message service.</param>
        public EngineElement(
            IUnitOfWork uow,
            IEngineRepository enginRepo,
            ILogger <EngineElement> logger,
            IMessageService messageService) : base(logger, messageService)
        {
            this.uow = uow;
            this.engineRepository = enginRepo;
            inputProperties       = new List <IEngineElementProperty>();
            outputProperties      = new List <IEngineElementProperty>();

            // Create the instance ID for this element
            instance = engineRepository.CreateNewInstance();
        }