Example #1
0
 /// <summary>
 /// Intercepts the given method call and replaces it with the proxy action.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="kernel">The kernel.</param>
 /// <param name="methodExpr">The method to intercept.</param>
 /// <param name="action">The action to take in its place.</param>
 public static void InterceptReplace <T>(this IKernel kernel,
                                         Expression <Action <T> > methodExpr,
                                         Action <IInvocation> action)
 {
     kernel.AddMethodInterceptor(GetMethodFromExpression(methodExpr), action);
 }
Example #2
0
 /// <summary>
 /// Intercepts and the replaces set call of a property.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="kernel">The kernel.</param>
 /// <param name="propertyExpr">The set_ property expression to replace.</param>
 /// <param name="action">The action to take in its place.</param>
 public static void InterceptReplaceSet <T>(this IKernel kernel,
                                            Expression <Func <T, object> > propertyExpr,
                                            Action <IInvocation> action)
 {
     kernel.AddMethodInterceptor(GetSetterFromExpression(propertyExpr), action);
 }