Esempio n. 1
0
        public static IAggregatePipelineTaskBuilder <TPipelineTaskBuilder, TParentContext, TContext> RunAction <TPipelineTaskBuilder, TParentContext, TContext>(
            this IAggregatePipelineTaskBuilder <TPipelineTaskBuilder, TParentContext, TContext> builder,
            Action <TContext> action)
            where TPipelineTaskBuilder : IPipelineTaskBuilder <TParentContext>
        {
            var task = new ActionTaskPipelineBuilder <TContext>()
            {
                Action = action
            };

            builder.EnqueueTask(task);

            return(builder);
        }
        /*
         * public static ForEachPipelineTaskBuilder<TPipelineTaskBuilder, TParentContext, TContext, TElement> ForEach<TPipelineTaskBuilder, TParentContext, TContext, TElement>(
         *  this IAggregatePipelineTaskBuilder<TPipelineTaskBuilder, TParentContext, TContext> builder,
         *  Expression<Func<TContext, IEnumerable<TElement>>> selector)
         *  where TPipelineTaskBuilder : IPipelineTaskBuilder<TParentContext>
         * {
         *  var task = new ForEachPipelineTaskBuilder<TPipelineTaskBuilder, TParentContext, TContext, TElement>(builder)
         *  {
         *      Selector = selector
         *  };
         *
         *  builder.EnqueueTask(task);
         *
         *  var aggBuilder = new AggregatePipelineNewContextTaskBuilder<ForEachPipelineTaskBuilder<TPipelineTaskBuilder, TParentContext, TContext, TElement>, TContext, IForEachTaskContext<TContext, TElement>>(task);
         *  task.Task = aggBuilder;
         *
         *  return task;
         * }
         */
        public static IAggregatePipelineTaskBuilder <ForEachPipelineTaskBuilder <TPipelineTaskBuilder, TParentContext, TContext, TElement>, TContext, IForEachTaskContext <TContext, TElement> > ForEach <TPipelineTaskBuilder, TParentContext, TContext, TElement>(
            this IAggregatePipelineTaskBuilder <TPipelineTaskBuilder, TParentContext, TContext> builder,
            Expression <Func <TContext, IEnumerable <TElement> > > selector)
            where TPipelineTaskBuilder : IPipelineTaskBuilder <TParentContext>
        {
            var task = new ForEachPipelineTaskBuilder <TPipelineTaskBuilder, TParentContext, TContext, TElement>(builder)
            {
                Selector = selector
            };

            builder.EnqueueTask(task);

            task.Task = new AggregatePipelineNewContextTaskBuilder <ForEachPipelineTaskBuilder <TPipelineTaskBuilder, TParentContext, TContext, TElement>, TContext, IForEachTaskContext <TContext, TElement> >(task);

            return(task.Task);
        }
        public static IAggregatePipelineTaskBuilder <ConditionalPipelineTaskBuilder <TPipelineTaskBuilder, TParentContext, TContext>, TContext, TContext> If <TPipelineTaskBuilder, TParentContext, TContext>(
            this IAggregatePipelineTaskBuilder <TPipelineTaskBuilder, TParentContext, TContext> builder,
            Expression <Func <TContext, bool> > condition)
            where TPipelineTaskBuilder : IPipelineTaskBuilder <TParentContext>
        {
            var task = new ConditionalPipelineTaskBuilder <TPipelineTaskBuilder, TParentContext, TContext>(builder)
            {
                Condition = condition
            };

            builder.EnqueueTask(task);

            var aggBuilder = new AggregatePipelineTaskBuilder <ConditionalPipelineTaskBuilder <TPipelineTaskBuilder, TParentContext, TContext>, TContext>(task);

            task.TrueTask = aggBuilder;

            return(task.TrueTask);
        }