Esempio n. 1
0
 public static TInterface CreateEfficientAopProxy <TInterface>(object origin, IAopInterceptor aopInterceptor)
 {
     lock (EfficientAopProxyEmitter)
     {
         Type originType = origin.GetType();
         return((TInterface)EfficientAopProxyEmitter.EmitProxyType <TInterface>(originType).GetConstructor(new Type[] { originType, typeof(IAopInterceptor) }).Invoke(new object[] { origin, aopInterceptor }));
     }
 }
Esempio n. 2
0
 public static TInterface CreateEfficientAopProxy <TInterface>(object origin, IAopInterceptor aopInterceptor)
 {
     lock (DynamicProxyFactory.EfficientAopProxyEmitter)
     {
         Type orignType   = origin.GetType();
         Type dynamicType = DynamicProxyFactory.EfficientAopProxyEmitter.EmitProxyType <TInterface>(orignType);
         //DynamicProxyFactory.SimpleAopProxyEmitter.Save();
         ConstructorInfo ctor = dynamicType.GetConstructor(new Type[] { orignType, typeof(IAopInterceptor) });
         return((TInterface)ctor.Invoke(new object[] { origin, aopInterceptor }));
     }
 }
Esempio n. 3
0
 public static object CreateEfficientAopProxy(Type proxyIntfaceType, object origin, IAopInterceptor aopInterceptor)
 {
     lock (EfficientAopProxyEmitter)
     {
         Type originType = origin.GetType();
         return(EfficientAopProxyEmitter.EmitProxyType(proxyIntfaceType, originType).GetConstructor(new Type[] { originType, typeof(IAopInterceptor) }).Invoke(new object[] { origin, aopInterceptor }));
     }
 }
Esempio n. 4
0
 public static object CreateSimpleAopProxy(Type proxyIntfaceType, object origin, IAopInterceptor aopInterceptor)
 {
     lock (DynamicProxyFactory.SimpleAopProxyEmitter)
     {
         Type orignType   = origin.GetType();
         Type dynamicType = DynamicProxyFactory.SimpleAopProxyEmitter.EmitProxyType(proxyIntfaceType, orignType);
         //DynamicProxyFactory.SimpleAopProxyEmitter.Save();
         ConstructorInfo ctor = dynamicType.GetConstructor(new Type[] { orignType, typeof(IAopInterceptor) });
         return(ctor.Invoke(new object[] { origin, aopInterceptor }));
     }
 }