예제 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var options = new RewriteOptions()
                          .AddRedirectToHttps();

            MiddlewareRegistration.RegisterTransactionPerRequest(app);

            app.UseRewriter(options);

            app.UseMvc();
        }
        private static IBrolicApplicationBuilder UseRegistration(
            this IBrolicApplicationBuilder brolicApplicationBuilder, MiddlewareRegistration middlewareRegistration)
        {
            switch (middlewareRegistration.Type)
            {
            case MiddlewareType.Delegate:
                brolicApplicationBuilder.Use(
                    middlewareRegistration.Middleware as Func <BrolicTrafficDelegate, BrolicTrafficDelegate>);
                break;

            case MiddlewareType.Class:
                brolicApplicationBuilder.UseMiddleware(middlewareRegistration.Middleware as Type, middlewareRegistration.Parameters);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(brolicApplicationBuilder);
        }
예제 #3
0
        public void Configure(IApplicationBuilder app,
                              ILoggerFactory loggerFactory,
                              IDataProtector dataProtector,
                              IDomainEventDispatcher domainEventDispatcher,
                              IMessageSender messageSender)
        {
            DataProtection.SetDataProtector(dataProtector);
            DomainEvents.SetDomainEventDispatcher(domainEventDispatcher);
            Message.SetMessageSender(messageSender);

            if (Environment.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            loggerFactory.AddLog4Net();

            MiddlewareRegistration.Register(app);

            app.UseHttpsRedirection();
            app.UseHsts();
            app.UseMvc();
        }