/// <summary> /// Gets current the <see cref="IFieldInterceptionContext"/> associated with the <see cref="FieldInterceptorRegistry"/>. /// </summary> /// <param name="context">The <see cref="IFieldInterceptionContext"/> instance that describes the state of the method call when the field getter or setter is called.</param> /// <returns>The field interceptor that will be used to preempt field getter and setter calls.</returns> public static IFieldInterceptor GetInterceptor(IFieldInterceptionContext context) { lock (_lock) { if (_interceptor != null && _interceptor.CanIntercept(context)) return _interceptor; } return null; }
/// <summary> /// Gets current the <see cref="IFieldInterceptionContext" /> associated with the /// <see cref="FieldInterceptorRegistry" />. /// </summary> /// <param name="context"> /// The <see cref="IFieldInterceptionContext" /> instance that describes the state of the method call /// when the field getter or setter is called. /// </param> /// <returns>The field interceptor that will be used to preempt field getter and setter calls.</returns> public static IFieldInterceptor GetInterceptor(IFieldInterceptionContext context) { lock (_lock) { if (_interceptor != null && _interceptor.CanIntercept(context)) { return(_interceptor); } } return(null); }
public object SetValue(IFieldInterceptionContext context, object value) { // Prevent any setter calls by replacing the setter value return("freeze!"); }
public object GetValue(IFieldInterceptionContext context) { return("freeze!"); }
public bool CanIntercept(IFieldInterceptionContext context) { return(true); }
public object SetValue(IFieldInterceptionContext context, object value) { // Prevent any setter calls by replacing the setter value return "freeze!"; }
public object GetValue(IFieldInterceptionContext context) { return "freeze!"; }
public bool CanIntercept(IFieldInterceptionContext context) { return true; }