public static IAggregatePipelineTaskBuilder <ConditionalPipelineTaskBuilder <TPipelineTaskBuilder, TParentContext, TContext>, TContext, TContext> Else <TPipelineTaskBuilder, TParentContext, TContext>(
            this IAggregatePipelineTaskBuilder <ConditionalPipelineTaskBuilder <TPipelineTaskBuilder, TParentContext, TContext>, TContext, TContext> builder)
            where TPipelineTaskBuilder : IPipelineTaskBuilder <TParentContext>
        {
            var aggBuilder = new AggregatePipelineTaskBuilder <ConditionalPipelineTaskBuilder <TPipelineTaskBuilder, TParentContext, TContext>, TContext>(builder.Builder);

            builder.Builder.FalseTask = aggBuilder;

            return(builder.Builder.FalseTask);
        }
Beispiel #2
0
        public AggregatePipelineTaskBuilder <PipelineTaskBuilder <TContext>, TContext> BeginPipeline()
        {
            using (var logger = LoggerProvider.Create <PipelineTaskBuilder <TContext> >())
            {
                logger.LogTrace($"Entering '{this.GetType()}.{nameof(this.BeginPipeline)}'");

                if (this._rootTask != null)
                {
                    throw new Exception("Cannot begin pipeline more than once for a PipelineBuilder");
                }

                var result = this._rootTask = new AggregatePipelineTaskBuilder <PipelineTaskBuilder <TContext>, TContext>(this);
                logger.LogTrace($"Leaving '{this.GetType()}.{nameof(this.BeginPipeline)}'");
                return(result);
            }
        }
        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);
        }