/// <summary>
 /// Execute the pipeline with the given input.
 /// </summary>
 /// <param name="input">Input to the method call.</param>
 /// <param name="target">The ultimate target of the call.</param>
 /// <returns>Return value from the pipeline.</returns>
 public VirtualMethodInvocation Invoke(VirtualMethodInvocation input, InvokeInterceptionBehaviorDelegate target)
 {
     if (interceptionBehaviors == null)
     {
         return(target(input, null));
     }
     return(interceptionBehaviors.Invoke(input, () => target));
 }
        /// <summary>
        /// Execute the pipeline with the given input.
        /// </summary>
        /// <param name="input">Input to the method call.</param>
        /// <param name="target">The ultimate target of the call.</param>
        /// <returns>Return value from the pipeline.</returns>
        public IMethodReturn Invoke(IMethodInvocation input, InvokeInterceptionBehaviorDelegate target)
        {
            if (_interceptionBehaviors.Count == 0)
            {
                return(target(input, null));
            }

            int interceptorIndex = 0;

            IMethodReturn result = _interceptionBehaviors[0].Invoke(input, delegate
            {
                ++interceptorIndex;
                if (interceptorIndex < _interceptionBehaviors.Count)
                {
                    return(_interceptionBehaviors[interceptorIndex].Invoke);
                }
                return(target);
            });

            return(result);
        }
        /// <summary>
        /// Execute the pipeline with the given input.
        /// </summary>
        /// <param name="input">Input to the method call.</param>
        /// <param name="target">The ultimate target of the call.</param>
        /// <returns>Return value from the pipeline.</returns>
        public IMethodReturn Invoke(IMethodInvocation input, InvokeInterceptionBehaviorDelegate target)
        {
            if (interceptionBehaviors.Count == 0)
            {
                return target(input, null);
            }

            int interceptorIndex = 0;

            IMethodReturn result = interceptionBehaviors[0].Invoke(input, delegate
                                      {
                                          ++interceptorIndex;
                                          if (interceptorIndex < interceptionBehaviors.Count)
                                          {
                                              return interceptionBehaviors[interceptorIndex].Invoke;
                                          }
                                          else
                                          {
                                              return target;
                                          }
                                      });
            return result;
        }