Пример #1
0
        private object InterceptAround(object currentInterceptor)
        {
            //invoke the next interceptor
            IAroundInterceptor interceptor = (IAroundInterceptor)currentInterceptor;

            Step++;
            return(interceptor.HandleCall(this));
        }
Пример #2
0
 public static object CreateAopProxy(Type proxyIntfaceType, object origin, IMethodInterceptor methodInterceptor, IAroundInterceptor aroundInterceptor)
 {
     lock (DynamicProxyFactory.AopProxyEmitter)
     {
         Type orignType   = origin.GetType();
         Type dynamicType = DynamicProxyFactory.AopProxyEmitter.EmitProxyType(proxyIntfaceType, orignType);
         //DynamicProxyFactory.AopProxyEmitter.Save();
         ConstructorInfo ctor = dynamicType.GetConstructor(new Type[] { orignType, typeof(IMethodInterceptor), typeof(IAroundInterceptor) });
         return(ctor.Invoke(new object[] { origin, methodInterceptor, aroundInterceptor }));
     }
 }
Пример #3
0
 public static TInterface CreateAopProxy <TInterface>(TInterface origin, IMethodInterceptor methodInterceptor, IAroundInterceptor aroundInterceptor)
 {
     lock (DynamicProxyFactory.AopProxyEmitter)
     {
         Type orignType   = typeof(TInterface);
         Type dynamicType = DynamicProxyFactory.AopProxyEmitter.EmitProxyType <TInterface>(orignType);
         //DynamicProxyFactory.AopProxyEmitter.Save();
         ConstructorInfo ctor = dynamicType.GetConstructor(new Type[] { orignType, typeof(IMethodInterceptor), typeof(IAroundInterceptor) });
         return((TInterface)ctor.Invoke(new object[] { origin, methodInterceptor, aroundInterceptor }));
     }
 }