Ejemplo n.º 1
0
        private InterceptorPipeline CreatePipeline(MethodInfo method, IEnumerable <IInterceptor> interceptors)
        {
            InterceptorPipelineKey key = InterceptorPipelineKey.ForMethod(method);

            if (_pipelines.ContainsKey(key))
            {
                return(_pipelines[key]);
            }
#if NetCore
            var baseMethod = method.GetRuntimeBaseDefinition();
#else
            var baseMethod = method.GetBaseDefinition();
#endif
            if (Equals(baseMethod, method))
            {
                _pipelines[key] = new InterceptorPipeline(interceptors);
                return(_pipelines[key]);
            }

            var basePipeline = CreatePipeline(baseMethod, interceptors);
            _pipelines[key] = basePipeline;
            return(basePipeline);
        }
Ejemplo n.º 2
0
        private InterceptorPipeline CreatePipeline(MethodBase methodBase, IEnumerable <IInterceptor> interceptors)
        {
            InterceptorPipelineKey key = InterceptorPipelineKey.ForMethod(methodBase);

            if (_pipelines.ContainsKey(key))
            {
                return(_pipelines[key]);
            }
            InterceptorPipeline pipeline;

#if NetCore
            if (methodBase.IsConstructor)
#else
            if (methodBase.MemberType == MemberTypes.Constructor)
#endif
            {
                pipeline        = new InterceptorPipeline(interceptors);
                _pipelines[key] = pipeline;
                return(pipeline);
            }
            var method = (MethodInfo)methodBase;
#if NetCore
            var baseMethod = method.GetRuntimeBaseDefinition();
#else
            var baseMethod = method.GetBaseDefinition();
#endif
            if (baseMethod == null || Equals(baseMethod, method))
            {
                pipeline        = new InterceptorPipeline(interceptors);
                _pipelines[key] = pipeline;
                return(pipeline);
            }

            pipeline        = CreatePipeline(baseMethod, interceptors);
            _pipelines[key] = pipeline;
            return(pipeline);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Set a new pipeline for a methodBase.
 /// </summary>
 /// <param name="method">The methodBase on which the pipeline should be set.</param>
 /// <param name="pipeline">The new pipeline.</param>
 public void SetPipeline(MethodBase method, InterceptorPipeline pipeline)
 {
     _pipelines[InterceptorPipelineKey.ForMethod(method)] = pipeline;
 }