public static IObjectFieldDescriptor Use <TMiddleware>(
     this IObjectFieldDescriptor descriptor)
     where TMiddleware : class
 {
     return(descriptor.Use(
                ClassMiddlewareFactory.Create <TMiddleware>()));
 }
 public static IMiddlewareConfiguration Use <TMiddleware>(
     this IMiddlewareConfiguration configuration)
     where TMiddleware : class
 {
     return(configuration.Use(
                ClassMiddlewareFactory.Create <TMiddleware>()));
 }
 public static IMiddlewareConfiguration Use <TMiddleware>(
     this IMiddlewareConfiguration configuration,
     Func <IServiceProvider, FieldDelegate, TMiddleware> factory)
     where TMiddleware : class
 {
     return(configuration.Use(
                ClassMiddlewareFactory.Create <TMiddleware>(factory)));
 }
 public static IMiddlewareConfiguration Map(
     this IMiddlewareConfiguration configuration,
     FieldReference fieldReference,
     FieldMiddleware middleware)
 {
     return(configuration.Use(
                ClassMiddlewareFactory.Create <MapMiddleware>(
                    (s, n) => new MapMiddleware(
                        n, fieldReference, middleware(n)))));
 }
        public static IObjectFieldDescriptor Use <TMiddleware>(
            this IObjectFieldDescriptor descriptor,
            Func <IServiceProvider, FieldDelegate, TMiddleware> factory)
            where TMiddleware : class
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            return(descriptor.Use(
                       ClassMiddlewareFactory.Create <TMiddleware>(factory)));
        }
 public static IMiddlewareConfiguration Map <TMiddleware>(
     this IMiddlewareConfiguration configuration,
     FieldReference fieldReference)
     where TMiddleware : class
 {
     return(configuration.Use(
                ClassMiddlewareFactory.Create <MapMiddleware>(
                    (s, n) =>
     {
         FieldMiddleware classMiddleware =
             ClassMiddlewareFactory.Create <TMiddleware>();
         return new MapMiddleware(
             n, fieldReference, classMiddleware(n));
     })));
 }
 public static IMiddlewareConfiguration Map <TMiddleware>(
     this IMiddlewareConfiguration configuration,
     FieldReference fieldReference,
     Func <IServiceProvider, FieldDelegate, TMiddleware> factory)
     where TMiddleware : class
 {
     return(configuration.Use(
                ClassMiddlewareFactory.Create <MapMiddleware>(
                    (s, n) =>
     {
         FieldMiddleware classMiddleware =
             ClassMiddlewareFactory.Create <TMiddleware>(factory);
         return new MapMiddleware(
             n, fieldReference, classMiddleware(n));
     })));
 }
 public static IHttpPipelineBuilder Use <T>(
     this IHttpPipelineBuilder builder)
 {
     return(builder.Use(ClassMiddlewareFactory.Create(typeof(T))));
 }