Ejemplo n.º 1
0
        public override object Intercept(IInvocationInfo info)
        {
            // Instead of using the proxy as the target,
            // modify the InvocationInfo to show the actual target
            var proxyType = _proxyFactory.CreateProxyType(typeof (IInvocationInfo), new Type[0]);
            var infoProxy = Activator.CreateInstance(proxyType) as IProxy;

            if (infoProxy == null)
                return base.Intercept(info);

            var modifiedInfo = (IInvocationInfo) infoProxy;

            // Replace the proxy target with the actual target
            var infoInterceptor = new InvocationInfoInterceptor(info, _getActualTarget, MethodInvoker);
            infoProxy.Interceptor = infoInterceptor;

            return _interceptor.Intercept(modifiedInfo);
        }
Ejemplo n.º 2
0
        public override object Intercept(IInvocationInfo info)
        {
            // Instead of using the proxy as the target,
            // modify the InvocationInfo to show the actual target
            var proxyType = _proxyFactory.CreateProxyType(typeof(IInvocationInfo), new Type[0]);
            var infoProxy = Activator.CreateInstance(proxyType) as IProxy;

            if (infoProxy == null)
            {
                return(base.Intercept(info));
            }

            var modifiedInfo = (IInvocationInfo)infoProxy;

            // Replace the proxy target with the actual target
            var infoInterceptor = new InvocationInfoInterceptor(info, _getActualTarget, MethodInvoker);

            infoProxy.Interceptor = infoInterceptor;

            return(_interceptor.Intercept(modifiedInfo));
        }