public static IInterceptionConfiguration InterceptDbContextSave <TDbContext>(this FluentAspectOptions options) where TDbContext : DbContext { return(options.Intercept(c => c.Target?.GetType().IsAssignableTo <TDbContext>() == true && (c.ProxyMethod.Name == nameof(DbContext.SaveChanges) || c.ProxyMethod.Name == nameof(DbContext.SaveChangesAsync) ) )); }
public static IInterceptionConfiguration InterceptAll(this FluentAspectOptions options) => options.Intercept(_ => true);
public static IInterceptionConfiguration InterceptMethod(this FluentAspectOptions options, Func <MethodInfo, bool> methodPredict) { return(options.Intercept(invocation => methodPredict(invocation.Method ?? invocation.ProxyMethod))); }