public virtual void Weave(TypeDefinition item) { if (item.Interfaces.Contains(_hostType)) return; item.Interfaces.Add(_hostType); item.AddProperty("MethodBodyReplacementProvider", typeof (IMethodReplacementProvider)); item.AddProperty("MethodCallReplacementProvider", typeof (IMethodReplacementProvider)); }
public override void Weave(TypeDefinition item) { base.Weave(item); // Implement IModifiableType if (item.Interfaces.Contains(_modifiableInterfaceType)) return; item.Interfaces.Add(_modifiableInterfaceType); item.AddProperty("IsInterceptionDisabled", typeof(bool)); item.AddProperty("AroundInvokeProvider", typeof(IAroundInvokeProvider)); }
public void Weave(TypeDefinition type) { // Implement IActivatorHost only once if (type.Interfaces.Contains(_hostInterfaceType)) return; type.AddProperty("Activator", _activatorPropertyType); if (!type.Interfaces.Contains(_hostInterfaceType)) type.Interfaces.Add(_hostInterfaceType); }
/// <summary> /// Constructs a type that implements the /// <see cref="IProxy"/> interface. /// </summary> /// <param name="module">The module that will hold the target type.</param> /// <param name="targetType">The type that will implement the <see cref="IProxy"/> interface.</param> public void Construct(ModuleDefinition module, TypeDefinition targetType) { TypeReference proxyInterfaceType = module.Import(typeof (IProxy)); TypeReference interceptorType = module.Import(typeof (IInterceptor)); // Implement the IProxy interface only once if (targetType.Interfaces.Contains(proxyInterfaceType)) return; targetType.Interfaces.Add(proxyInterfaceType); targetType.AddProperty("Interceptor", interceptorType); }