Beispiel #1
0
 public static void Intercept <TInterceptor>(this IRegistrator registrator, Func <Type, bool> predicate)
     where TInterceptor : class, IInterceptor
 {
     foreach (var registration in registrator.GetServiceRegistrations().Where(r => predicate(r.ServiceType)))
     {
         registrator.Intercept <TInterceptor>(registration.ServiceType);
     }
 }
Beispiel #2
0
 public static void InterceptAsync <TService, TInterceptor>(this IRegistrator registrator, object serviceKey = null)
     where TInterceptor : class, IAsyncInterceptor
 {
     registrator.Register <AsyncInterceptor <TInterceptor> >();
     registrator.Intercept <TService, AsyncInterceptor <TInterceptor> >(serviceKey);
 }
 public static void Intercept <TInterceptor>(this IRegistrator registrator, Type serviceType, object serviceKey = null)
     where TInterceptor : class, IInterceptor
 {
     registrator.Intercept <TInterceptor>(serviceType, serviceType, serviceKey);
 }
Beispiel #4
0
 public static void Intercept <TService, TInterceptor>(this IRegistrator registrator, object serviceKey = null)
     where TInterceptor : class, IInterceptor =>
 registrator.Intercept <TInterceptor>(typeof(TService), serviceKey);
Beispiel #5
0
 public static void Intercept <TInterceptor>(this IRegistrator registrator, Type serviceType, object serviceKey = null)
     where TInterceptor : class, IInterceptor =>
 registrator.Intercept(serviceType, Parameters.Of.Type(typeof(IInterceptor[]), typeof(TInterceptor[])), serviceKey);