public static FluentAspectOptions NoInterceptMethod <T>(this FluentAspectOptions options, Expression <Func <MethodInfo, bool> > andExpression) { Expression <Func <MethodInfo, bool> > expression = m => m.DeclaringType !.IsAssignableTo <T>(); expression = expression.And(Guard.NotNull(andExpression, nameof(andExpression))); options.NoInterceptMethod(expression.Compile()); return(options); }
public static FluentAspectOptions NoInterceptProperty <T>(this FluentAspectOptions options, Expression <Func <T, object> > expression) { var prop = expression.GetProperty(); if (null == prop) { throw new InvalidOperationException("no property found"); } if (prop.GetMethod != null) { options = options.NoInterceptMethod <T>(prop.GetMethod); } if (prop.SetMethod != null) { options = options.NoInterceptMethod <T>(prop.SetMethod); } return(options); }
public static FluentAspectOptions NoInterceptMethod(this FluentAspectOptions options, MethodInfo method) { if (null == method) { throw new ArgumentNullException(nameof(method)); } var methodSignature = method.GetSignature(); return(options.NoInterceptMethod(m => m.GetSignature().Equals(methodSignature))); }
public static FluentAspectOptions NoInterceptMethod <T>(this FluentAspectOptions options, MethodCallExpression methodCallExpression) { var innerMethod = methodCallExpression.Method; if (null == innerMethod) { throw new InvalidOperationException($"no method found"); } Expression <Func <MethodInfo, bool> > expression = m => m.DeclaringType !.IsAssignableTo <T>(); var methodSignature = innerMethod.GetSignature(); expression = expression.And(m => m.GetSignature().Equals(methodSignature)); return(options.NoInterceptMethod(expression.Compile())); }
public static FluentAspectOptions NoInterceptPropertySetter <T>(this FluentAspectOptions options, Expression <Func <T, object> > expression) { var prop = expression.GetProperty(); if (null == prop) { throw new InvalidOperationException("no property found"); } if (!prop.CanWrite || prop.SetMethod == null) { throw new InvalidOperationException($"the property {prop.Name} can not write"); } return(options.NoInterceptMethod <T>(prop.SetMethod)); }
public static FluentAspectOptions NoInterceptMethod <T>(this FluentAspectOptions options, Expression <Action <T> > method) { options.NoInterceptMethod <T>(method.GetMethodExpression()); return(options); }