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 })); } }
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 })); } }
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 })); } }
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 })); } }