public SurroundMethodBody(IMethodBodyRewriterParameters parameters) { _methodReplacementProvider = parameters.MethodReplacementProvider; _aroundInvokeProvider = parameters.AroundInvokeProvider; _invocationInfo = parameters.InvocationInfo; _returnValue = parameters.ReturnValue; _interceptionDisabled = parameters.InterceptionDisabled; var getMethodReplacementProvider = new GetMethodReplacementProvider(_methodReplacementProvider, parameters.TargetMethod, parameters.GetMethodReplacementProviderMethod); _getMethodReplacementProvider = getMethodReplacementProvider; _registryType = parameters.RegistryType; }
/// <summary> /// Initializes a new instance of the <see cref="InterceptAndSurroundMethodBody"/> class. /// </summary> /// <param name="emitter">The emitter that will instantiate the <see cref="IInvocationInfo"/> instance.</param> /// <param name="getInterceptionDisabled">The emitter that will determine whether or not method interception is enabled.</param> /// <param name="surroundMethodBody">The <see cref="ISurroundMethodBody"/> instance that will add the epilogs and prologs to the method body.</param> /// <param name="getInstanceMethodReplacementProvider">The emitter that will obtain the method replacement provider instance.</param> /// <param name="getClassMethodReplacementProvider">The emitter that will obtain the class-level method replacement provider instance.</param> /// <param name="addMethodReplacement">The instruction emitter that will add the call to obtain the method body replacement instance. </param> /// <param name="parameters">The parameters that describe the context of the method body rewrite.</param> public InterceptAndSurroundMethodBody(IEmitInvocationInfo emitter, IInstructionEmitter getInterceptionDisabled, ISurroundMethodBody surroundMethodBody, IInstructionEmitter getInstanceMethodReplacementProvider, IInstructionEmitter getClassMethodReplacementProvider, IInstructionEmitter addMethodReplacement, IMethodBodyRewriterParameters parameters) { _getInterceptionDisabled = getInterceptionDisabled; _surroundMethodBody = surroundMethodBody; _getInstanceMethodReplacementProvider = getInstanceMethodReplacementProvider; _getClassMethodReplacementProvider = getClassMethodReplacementProvider; _addMethodReplacement = addMethodReplacement; _parameters = parameters; _emitter = emitter; _interceptionDisabled = parameters.InterceptionDisabled; }