示例#1
0
 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)
                              )
                              ));
 }
示例#2
0
 public static IInterceptionConfiguration InterceptAll(this FluentAspectOptions options)
 => options.Intercept(_ => true);
示例#3
0
 public static IInterceptionConfiguration InterceptMethod(this FluentAspectOptions options,
                                                          Func <MethodInfo, bool> methodPredict)
 {
     return(options.Intercept(invocation => methodPredict(invocation.Method ?? invocation.ProxyMethod)));
 }