Ejemplo n.º 1
0
        public TasksConfiguration Task <TTask, TWorkItem>(Action <TaskConfiguration <TWorkItem> > task = null)
            where TTask : Task <TWorkItem>
        {
            TaskConfiguration <TWorkItem> taskConfiguration = new TaskConfiguration <TWorkItem>(typeof(TTask));

            if (task != null)
            {
                task(taskConfiguration);
            }
            if (this._complexTasks.Contains(taskConfiguration))
            {
                throw new InvalidOperationException(string.Format("Task '{0}' has already been added.", taskConfiguration.Task.FullName));
            }
            this._complexTasks.Add(taskConfiguration);
            return(this);
        }
        /// <summary>
        /// Adds the specified <typeparamref name="TTask"/>.
        /// </summary>
        /// <typeparam name="TTask">Specifies the <see cref="IntegrationTask{TWorkItem}"/> to be added.</typeparam>
        /// <typeparam name="TWorkItem">Specifies the WorkItem that is used by this Task.</typeparam>
        /// <param name="task">Required in order to register one or more <see cref="Step{TWorkItem}"/></param> sequentially executed by this Task.
        public TasksConfiguration Task <TTask, TWorkItem>(Action <TaskConfiguration <TWorkItem> > task = null)
            where TTask : IntegrationTask <TWorkItem>
        {
            var configuration = new TaskConfiguration <TWorkItem>(Application, typeof(TTask));

            task?.Invoke(configuration);

            if (_complexTasks.Contains(configuration))
            {
                throw new InvalidOperationException(
                          $@"Task '{configuration.Task.FullName}' has already been added.");
            }

            _complexTasks.Add(configuration);

            return(this);
        }