コード例 #1
0
        ///// <summary>
        ///// 创建并返回当前方法的拦截器管道
        ///// </summary>
        //public InterceptorPipeline CreatePipeline(MethodInfo method, Func<IEnumerable<IInterceptor>> getInterceptors)
        //{
        //    var key = InterceptorPipelineKey.ForMethod(method);
        //    if (pipelines.ContainsKey(key))
        //        return pipelines[key];
        //    if (method.GetBaseDefinition() == method)
        //        return pipelines[key] = new InterceptorPipeline(getInterceptors());
        //    return pipelines[key] = CreatePipeline(method.GetBaseDefinition(), getInterceptors);
        //}
        /// <summary>
        /// 创建并返回当前方法的拦截器管道
        /// </summary>
        public InterceptorPipeline CreatePipeline(MethodInfo method, Func<MethodInfo, IEnumerable<IInterceptor>> getInterceptors)
        {
            var key = InterceptorPipelineKey.ForMethod(method);

            if(pipelines.ContainsKey(key))
                return pipelines[key];

            if(method.GetBaseDefinition() == method)
                return pipelines[key] = new InterceptorPipeline(getInterceptors(method));

            return pipelines[key] = CreatePipeline(method.GetBaseDefinition(), getInterceptors);
        }
コード例 #2
0
        ///// <summary>
        ///// 创建并返回当前方法的拦截器管道
        ///// </summary>
        //public InterceptorPipeline CreatePipeline(MethodInfo method, Func<IEnumerable<IInterceptor>> getInterceptors)
        //{
        //    var key = InterceptorPipelineKey.ForMethod(method);

        //    if (pipelines.ContainsKey(key))
        //        return pipelines[key];

        //    if (method.GetBaseDefinition() == method)
        //        return pipelines[key] = new InterceptorPipeline(getInterceptors());

        //    return pipelines[key] = CreatePipeline(method.GetBaseDefinition(), getInterceptors);
        //}

        /// <summary>
        /// 创建并返回当前方法的拦截器管道
        /// </summary>
        public InterceptorPipeline CreatePipeline(MethodInfo method, Func <MethodInfo, IEnumerable <IInterceptor> > getInterceptors)
        {
            var key = InterceptorPipelineKey.ForMethod(method);

            if (pipelines.ContainsKey(key))
            {
                return(pipelines[key]);
            }

            if (method.GetBaseDefinition() == method)
            {
                return(pipelines[key] = new InterceptorPipeline(getInterceptors(method)));
            }

            return(pipelines[key] = CreatePipeline(method.GetBaseDefinition(), getInterceptors));
        }
コード例 #3
0
        /// <summary>
        /// 设置当前方法的拦截器管道
        /// </summary>
        public void SetPipeline(MethodBase method, InterceptorPipeline pipeline)
        {
            var key = InterceptorPipelineKey.ForMethod(method);

            pipelines[key] = pipeline;
        }
コード例 #4
0
 /// <summary>
 /// 设置当前方法的拦截器管道
 /// </summary>
 public void SetPipeline(MethodBase method, InterceptorPipeline pipeline)
 {
     var key = InterceptorPipelineKey.ForMethod(method);
     pipelines[key] = pipeline;
 }