Exemplo n.º 1
0
 /// <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;
 }
 /// <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="target">The target.</param>
 /// <param name="targetType">Type of the target.</param>
 /// <param name="parameters">The parameters.</param>
 /// <param name="nextAdviceContext">The next advice context.</param>
 protected PropertyAdviceContext(IPropertyAdvice propertyAdvice, PropertyInfo propertyInfo, bool isSetter, object target, Type targetType, object[] parameters, AdviceContext nextAdviceContext)
     : this(propertyAdvice, propertyInfo, isSetter, new AdviceValues(target, targetType, parameters), nextAdviceContext)
 {
 }
 /// <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);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MethodAsyncAdviceContext"/> class.
 /// </summary>
 /// <param name="methodAdvice">The method advice.</param>
 /// <param name="targetMethod">The target method.</param>
 /// <param name="target">The target.</param>
 /// <param name="targetType">Type of the target.</param>
 /// <param name="parameters">The parameters.</param>
 /// <param name="nextAdviceContext">The next advice context.</param>
 protected MethodAsyncAdviceContext(IMethodAsyncAdvice methodAdvice, MethodBase targetMethod, object target, Type targetType, object[] parameters,
                                    AdviceContext nextAdviceContext)
     : this(methodAdvice, targetMethod, new AdviceValues(target, targetType, parameters), nextAdviceContext)
 {
 }
 /// <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;
 }
Exemplo n.º 7
0
 /// <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;
 }
Exemplo n.º 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;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ParameterAdviceContext"/> class.
 /// </summary>
 /// <param name="parameterAdvice">The parameter advice.</param>
 /// <param name="targetParameter">The target parameter.</param>
 /// <param name="parameterIndex">Index of the parameter.</param>
 /// <param name="target">The target.</param>
 /// <param name="targetType">Type of the target.</param>
 /// <param name="parameters">The parameters.</param>
 /// <param name="nextAdviceContext">The next advice context.</param>
 protected ParameterAdviceContext(IParameterAdvice parameterAdvice, ParameterInfo targetParameter, int parameterIndex,
                                  object target, Type targetType, object[] parameters, AdviceContext nextAdviceContext)
     : this(parameterAdvice, targetParameter, parameterIndex, new AdviceValues(target, targetType, parameters), nextAdviceContext)
 {
 }
Exemplo n.º 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;
 }
Exemplo n.º 11
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;
 }
Exemplo n.º 12
0
 internal SyncAdviceContext(AdviceValues adviceValues, AdviceContext nextAdviceContext)
     : base(adviceValues, nextAdviceContext)
 {
 }