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 IMiddlewareConfiguration UseGlobalObjectIdentifier(
            this IMiddlewareConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            return(configuration.Use <IdMiddleware>());
        }
 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));
     })));
 }