예제 #1
0
        public MethodDefinition CreateAdapterConstructor(Dictionary <MethodReference, MethodReference> methodMap)
        {
            var            adapterName        = string.Format("{0}Adapter", _targetDependency.Name);
            var            namespaceName      = _interfaceType.Namespace;
            TypeDefinition adapterType        = _createAdapterType.CreateType(adapterName, namespaceName, methodMap);
            var            adapterConstructor = adapterType.Constructors[0];

            return(adapterConstructor);
        }
예제 #2
0
        public IProxyTemplate GenerateProxyTemplate(IProxyDefinition proxyDefinition)
        {
            if (proxyDefinition == null)
            {
                throw new ArgumentNullException("proxyDefinition");
            }

            //这一步就是用于收集要切的方法和属性、事件
            proxyDefinition.AcceptVisitor(this);

            var type = _typeBuilder.CreateType();

            return(new ProxyTemplate(proxyDefinition, type, _eventInfos, _propertyInfos, _methodInfos));
        }
예제 #3
0
 public Type CreateType()
 {
     return(_typeBuilder.CreateType());
 }