Exemple #1
0
        private IInvocation PrepareInvocationForProceed(IInvocation invocation)
        {
            var rmi = new DynamicMethodInvocation(Proxy, Target, TargetMethod, ProxyMethod, Arguments, TargetType, Interceptors);

            rmi.currentInterceptorIndex = currentInterceptorIndex + 1;
            return(rmi);
        }
Exemple #2
0
        public object Invoke(object proxy, object target, Type targetType,
                             MethodInfo targetMethod, MethodInfo proxyMethod, object[] args, IList interceptors)
        {
            List <IInterceptor> tmps = new List <IInterceptor>(interceptors?.Count ?? 0);

            foreach (object obj in interceptors)
            {
                if (obj is IInterceptor)
                {
                    tmps.Add((IInterceptor)obj);
                }
            }

            IInvocation invocation = new DynamicMethodInvocation(proxy, target, targetMethod, proxyMethod, args, targetType, tmps);

            return(invocation.Proceed());
        }