public static FluentAspectOptions NoInterceptType(this FluentAspectOptions options, Func <Type, bool> typesFilter) { Guard.NotNull(options, nameof(options)); Guard.NotNull(typesFilter, nameof(typesFilter)); options.NoInterceptMethod(m => typesFilter(m.DeclaringType)); return(options); }
public static FluentAspectOptions NoInterceptType(this FluentAspectOptions options, Func <Type, bool> typesFilter) { if (null != typesFilter) { options.NoInterceptMethod(m => typesFilter(m.DeclaringType)); } return(options); }
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 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, Expression <Func <MethodInfo, bool> > andExpression = null) { Expression <Func <MethodInfo, bool> > expression = m => m.DeclaringType.IsAssignableTo <T>(); if (null != andExpression) { expression = expression.And(andExpression); } options.NoInterceptMethod(expression.Compile()); return(options); }
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) { throw new InvalidOperationException($"the property {prop.Name} can not write"); } return(options.NoInterceptMethod <T>(prop.SetMethod)); }
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 NoInterceptType <T>(this FluentAspectOptions options) { options.NoInterceptMethod(m => m.DeclaringType.IsAssignableTo <T>()); return(options); }
public static FluentAspectOptions NoInterceptMethod <T>(this FluentAspectOptions options, Expression <Action <T> > method) { options.NoInterceptMethod <T>(method.GetMethodExpression()); return(options); }