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); }
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)); }
public Type CreateType() { return(_typeBuilder.CreateType()); }