/// <summary> /// Initializes a new instance of the <see cref="AspectInfo" /> class. /// </summary> /// <param name="advices">The advices.</param> /// <param name="pointcutMethod">The pointcut method.</param> /// <param name="pointcutMethodHandle">The pointcut method handle.</param> /// <param name="pointcutMethodDelegate"></param> /// <param name="advisedMethod">The advised method.</param> /// <param name="advisedMethodHandle">The advised method handle.</param> public AspectInfo(IEnumerable <AdviceInfo> advices, MethodInfo pointcutMethod, RuntimeMethodHandle pointcutMethodHandle, ProceedDelegate pointcutMethodDelegate, MethodBase advisedMethod, RuntimeMethodHandle advisedMethodHandle) { Advices = advices.OrderByDescending(a => PriorityAttribute.GetLevel(a.Advice)).ToArray(); PointcutMethod = pointcutMethod; PointcutMethodHandle = pointcutMethodHandle; AdvisedMethod = advisedMethod; AdvisedMethodHandle = advisedMethodHandle; PointcutMethodDelegate = pointcutMethodDelegate; }
/// <summary> /// Creates the method call context, given a calling method and the inner method name. /// </summary> /// <param name="method">The method information.</param> /// <param name="methodHandle">The method handle.</param> /// <param name="innerMethod">Name of the inner method.</param> /// <param name="innerMethodHandle">The inner method handle.</param> /// <param name="innerMethodDelegate"></param> /// <param name="abstractedTarget">if set to <c>true</c> [abstracted target].</param> /// <returns></returns> private static AspectInfo CreateAspectInfo(MethodBase method, RuntimeMethodHandle methodHandle, MethodInfo innerMethod, RuntimeMethodHandle innerMethodHandle, ProceedDelegate innerMethodDelegate, bool abstractedTarget) { if (innerMethod == null && !abstractedTarget) { method = FindInterfaceMethod(method); } var advices = GetAdvices <IAdvice>(method, out var relatedPropertyInfo, out var relatedEventInfo); if (relatedPropertyInfo != null) { return(new AspectInfo(advices, innerMethod, innerMethodHandle, innerMethodDelegate, method, methodHandle, relatedPropertyInfo.Item1, relatedPropertyInfo.Item2)); } if (relatedEventInfo != null) { return(new AspectInfo(advices, innerMethod, innerMethodHandle, innerMethodDelegate, method, methodHandle, relatedEventInfo.Item1, relatedEventInfo.Item2)); } return(new AspectInfo(advices, innerMethod, innerMethodHandle, innerMethodDelegate, method, methodHandle)); }
public void G() { ProceedDelegate f = F; }
internal InnerMethodContext(AdviceValues adviceValues, MethodInfo innerMethod, ProceedDelegate innerMethodDelegate) : base(adviceValues, null) { _innerMethod = innerMethod; _innerMethodDelegate = innerMethodDelegate; }
/// <summary> /// Initializes a new instance of the <see cref="AspectInfo" /> class. /// </summary> /// <param name="advices">The advices.</param> /// <param name="pointcutMethod">The pointcut method.</param> /// <param name="pointcutMethodHandle">The pointcut method handle.</param> /// <param name="pointcutMethodDelegate"></param> /// <param name="advisedMethod">The advised method.</param> /// <param name="advisedMethodHandle">The advised method handle.</param> /// <param name="pointcutProperty">The pointcut property.</param> /// <param name="isPointcutPropertySetter">if set to <c>true</c> [is pointcut property setter].</param> /// <param name="pointcutEvent">The pointcut event.</param> /// <param name="isPointcutEventAdder">if set to <c>true</c> [is pointcut event adder].</param> public AspectInfo(IEnumerable <AdviceInfo> advices, MethodInfo pointcutMethod, RuntimeMethodHandle pointcutMethodHandle, ProceedDelegate pointcutMethodDelegate, MethodBase advisedMethod, RuntimeMethodHandle advisedMethodHandle, PropertyInfo pointcutProperty, bool isPointcutPropertySetter, EventInfo pointcutEvent, bool isPointcutEventAdder) : this(advices, pointcutMethod, pointcutMethodHandle, pointcutMethodDelegate, advisedMethod, advisedMethodHandle) { PointcutProperty = pointcutProperty; IsPointcutPropertySetter = isPointcutPropertySetter; PointcutEvent = pointcutEvent; IsPointcutEventAdder = isPointcutEventAdder; }