/// <summary>
 /// Initializes a new instance of the <see cref="PropertyAdviceContext"/> class.
 /// </summary>
 /// <param name="propertyAdvice">The property advice.</param>
 /// <param name="propertyInfo">The property information.</param>
 /// <param name="isSetter">if set to <c>true</c> [is setter].</param>
 /// <param name="adviceValues">The advice values.</param>
 /// <param name="nextAdviceContext">The next advice context.</param>
 /// <exception cref="System.InvalidOperationException">Only properties can be advised with this interface</exception>
 internal PropertyAdviceContext(IPropertyAdvice propertyAdvice, PropertyInfo propertyInfo, bool isSetter, AdviceValues adviceValues, AdviceContext nextAdviceContext)
     : base(adviceValues, nextAdviceContext)
 {
     _propertyAdvice = propertyAdvice;
     TargetProperty = propertyInfo;
     IsSetter = isSetter;
     if (IsGetter)
         Index = new ArraySpan<object>(AdviceValues.Parameters, 0, AdviceValues.Parameters.Length);
     else
         Index = new ArraySpan<object>(AdviceValues.Parameters, 1, AdviceValues.Parameters.Length - 1);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ParameterAdviceContext" /> class.
 /// </summary>
 /// <param name="parameterAdvice">The parameter advice.</param>
 /// <param name="targetParameter">The parameter information.</param>
 /// <param name="parameterIndex">Index of the parameter.</param>
 /// <param name="adviceValues">The advice values.</param>
 /// <param name="nextAdviceContext">The next advice context.</param>
 internal ParameterAdviceContext(IParameterAdvice parameterAdvice, ParameterInfo targetParameter, int parameterIndex,
                                 AdviceValues adviceValues, AdviceContext nextAdviceContext)
     : base(adviceValues, nextAdviceContext)
 {
     // input parameters must be method parameters (not return value) and not out (IsOut is exclusive)
     IsIn = parameterIndex >= 0 && !targetParameter.IsOut;
     // output parameters are return value or byref or out
     IsOut            = parameterIndex == -1 || targetParameter.ParameterType.IsByRef || targetParameter.IsOut;
     TargetParameter  = targetParameter;
     ParameterType    = targetParameter.ParameterType.IsByRef ? targetParameter.ParameterType.GetElementType() : targetParameter.ParameterType;
     _parameterAdvice = parameterAdvice;
     _parameterIndex  = parameterIndex;
 }
Exemple #3
0
 internal InnerMethodContext(AdviceValues adviceValues, MethodInfo innerMethod)
     : base(adviceValues, null)
 {
     _innerMethod = innerMethod;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyAdviceContext"/> class.
 /// </summary>
 /// <param name="propertyAdvice">The property advice.</param>
 /// <param name="propertyInfo">The property information.</param>
 /// <param name="isSetter">if set to <c>true</c> [is setter].</param>
 /// <param name="adviceValues">The advice values.</param>
 /// <param name="nextAdviceContext">The next advice context.</param>
 internal PropertyAdviceContext(IPropertyAdvice propertyAdvice, PropertyInfo propertyInfo, bool isSetter, AdviceValues adviceValues, AdviceContext nextAdviceContext)
     : base(adviceValues, nextAdviceContext)
 {
     _propertyAdvice = propertyAdvice;
     TargetProperty  = propertyInfo;
     IsSetter        = isSetter;
     if (IsGetter)
     {
         Index = new ArraySpan <object>(AdviceValues.Arguments, 0, AdviceValues.Arguments.Length);
     }
     else
     {
         Index = new ArraySpan <object>(AdviceValues.Arguments, 1, AdviceValues.Arguments.Length - 1);
     }
 }
 internal InnerMethodContext(AdviceValues adviceValues, MethodInfo innerMethod, ProceedDelegate innerMethodDelegate)
     : base(adviceValues, null)
 {
     _innerMethod         = innerMethod;
     _innerMethodDelegate = innerMethodDelegate;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MethodAdviceContext" /> class.
 /// </summary>
 /// <param name="methodAdvice">The method advice.</param>
 /// <param name="targetMethod">The target method.</param>
 /// <param name="adviceValues">The call values.</param>
 /// <param name="nextAdviceContext">The next advice context.</param>
 internal MethodAsyncAdviceContext(IMethodAsyncAdvice methodAdvice, MethodBase targetMethod, AdviceValues adviceValues, AdviceContext nextAdviceContext)
     : base(adviceValues, nextAdviceContext)
 {
     _methodAdvice = methodAdvice;
     TargetMethod  = targetMethod;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MethodAdviceContext" /> class.
 /// </summary>
 /// <param name="methodAdvice">The method advice.</param>
 /// <param name="targetMethod">The target method.</param>
 /// <param name="adviceValues">The call values.</param>
 /// <param name="nextAdviceContext">The next advice context.</param>
 internal MethodAdviceContext(IMethodAdvice methodAdvice, MethodBase targetMethod, AdviceValues adviceValues, AdviceContext nextAdviceContext)
     : base(adviceValues, nextAdviceContext)
 {
     _methodAdvice = methodAdvice;
     TargetMethod = targetMethod;
 }
Exemple #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyAdviceContext" /> class.
 /// </summary>
 /// <param name="eventAdvice">The event advice.</param>
 /// <param name="eventInfo">The event information.</param>
 /// <param name="isAdder">if set to <c>true</c> [is adder].</param>
 /// <param name="adviceValues">The advice values.</param>
 /// <param name="nextAdviceContext">The next advice context.</param>
 internal EventAdviceContext(IEventAdvice eventAdvice, EventInfo eventInfo, bool isAdder, AdviceValues adviceValues, AdviceContext nextAdviceContext)
     : base(adviceValues, nextAdviceContext)
 {
     _eventAdvice = eventAdvice;
     TargetEvent  = eventInfo;
     IsAdder      = isAdder;
 }
Exemple #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AdviceContext" /> class.
 /// </summary>
 /// <param name="adviceValues">The advice values.</param>
 /// <param name="nextAdviceContext">The next advice context.</param>
 internal AdviceContext(AdviceValues adviceValues, AdviceContext nextAdviceContext)
 {
     _nextAdviceContext = nextAdviceContext;
     AdviceValues       = adviceValues;
 }
Exemple #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AdviceContext" /> class.
 /// </summary>
 /// <param name="adviceValues">The advice values.</param>
 /// <param name="nextAdviceContext">The next advice context.</param>
 internal AdviceContext(AdviceValues adviceValues, AdviceContext nextAdviceContext)
 {
     _nextAdviceContext = nextAdviceContext;
     AdviceValues = adviceValues;
 }
Exemple #11
0
 internal SyncAdviceContext(AdviceValues adviceValues, AdviceContext nextAdviceContext)
     : base(adviceValues, nextAdviceContext)
 {
 }
 public InnerMethodContext(AdviceValues adviceValues, MethodInfo innerMethod)
     : base(adviceValues, null)
 {
     _innerMethod = innerMethod;
 }