Example #1
0
        public RequestRunner(
            SystemHttpClient client,
            ITransmissionSettings transmissionSettings,
            IArrayFormatter arrayFormatter,
            CookieContainer cookieContainer,
            MiddlewareCollection middleware)
        {
            var defaultMiddleware = new RequestMiddleware(client, transmissionSettings, arrayFormatter, cookieContainer);

            middleware.Append(defaultMiddleware);
            middlewareHead = middleware.BuildMiddlewareChain();
        }
Example #2
0
        public void Initialize()
        {
            IServiceCollection serviceCollection = CreateServiceCollection();

            ConfigureServices(serviceCollection);
            serviceCollection.AddSingleton(serviceCollection);
            serviceCollection.AddTransient <ICommandModelFactory, CommandModelFactory>();
            serviceCollection.AddTransient <ICommandViewFactory, CommandViewFactory>();

            ServiceProvider = serviceCollection.BuildServiceProvider();

            commands = CreateCommands() ?? new CommandPool();
            serviceCollection.AddSingleton(commands);

            middlewareCollection = ServiceProvider.GetService <MiddlewareCollection>();

            applicationHeader = CreateApplicationHeader();
            applicationFooter = CreateApplicationFooter();
        }
 public static MiddlewareCollection UseExceptionHandler(this MiddlewareCollection builder)
 {
     return(builder.UseMiddleware <ExceptionHandlerMiddleware>());
 }
Example #4
0
 public static MiddlewareCollection UseUselessMiddleware(this MiddlewareCollection builder)
 {
     return(builder.UseMiddleware <UselessMiddleware>());
 }
Example #5
0
 public static MiddlewareCollection UseCommands(this MiddlewareCollection builder)
 {
     return(builder.UseMiddleware <CommandMiddleware>());
 }