public ExecutionPipelineContext(ExecutionContext context, ExecutionPipeline pipeline, object parameter) : base(context.Executor, parameter)
		{
			if(pipeline == null)
				throw new ArgumentNullException("pipeline");

			_context = context;
			_pipeline = pipeline;
		}
Ejemplo n.º 2
0
			protected override ExecutionPipelineContext CreatePipelineContext(ExecutionContext context, ExecutionPipeline pipeline, object parameter)
			{
				var channelContext = context as IChannelContext;

				if(channelContext != null)
					return new ChannelPipelineContext(context, pipeline, parameter, channelContext.Channel);

				return base.CreatePipelineContext(context, pipeline, parameter);
			}
		public ChannelPipelineContext(ExecutionContext context, ExecutionPipeline pipeline, object data, IChannel channel) : base(context, pipeline, data)
		{
			_channel = channel;
		}
Ejemplo n.º 4
0
		protected virtual ExecutionPipelineContext CreatePipelineContext(ExecutionContext context, ExecutionPipeline pipeline, object parameter)
		{
			return new ExecutionPipelineContext(context, pipeline, parameter);
		}
Ejemplo n.º 5
0
		protected ExecutionResult Execute(ExecutionContext context)
		{
			if(context == null)
				throw new ArgumentNullException("context");

			//创建“Executing”事件的调用参数
			ExecutingEventArgs executingArgs = new ExecutingEventArgs(context);

			//激发“Executing”事件
			this.OnExecuting(executingArgs);

			if(executingArgs.Cancel)
				return new ExecutionResult(context);

			//通过选择器获取当前请求对应的管道集
			var pipelines = this.SelectPipelines(context, _pipelines);

			//如果当前执行的处理管道数为零则退出
			if(pipelines == null || pipelines.Count() < 1)
				return null;

			//调用执行器过滤器的前半截
			var stack = ExecutionUtility.InvokeFiltersExecuting(context.Executor.Filters, filter => this.OnFilterExecuting(filter, context));

			//执行管道集,并将其执行的最终结果保存到执行器上下文的Result属性中
			context.Result = this.InvokePipelines(pipelines, p => this.CreatePipelineContext(context, p, context.Parameter));

			//调用执行器过滤器的后半截
			ExecutionUtility.InvokeFiltersExecuted(stack, filter => this.OnFilterExecuted(filter, context));

			//激发“Executed”事件
			this.OnExecuted(new ExecutedEventArgs(context));

			return new ExecutionResult(context);
		}