Esempio n. 1
0
        public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IServiceScopeFactory serviceScopeFactory)
        {
            app.UseStaticFiles();
            app.UseRouting();

            loggerFactory.AddDataBase(serviceScopeFactory);

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapDefaultControllerRoute();
            });
        }
Esempio n. 2
0
        public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHostingEnvironment env)
        {
            loggerFactory.AddDataBase(Configuration);

            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseAuthentication();

            app.UseSwaggerDocumentation();

            app.UseMiddleware(typeof(ErrorHandlingMiddleware));

            app.UseMvc(routing =>
            {
                routing.MapRoute("api", "api/{controller}/{action}/{id?}");
            });

            app.UseStatusCodePagesWithRedirects("~/Errors/AppError{0}");

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Feeds}/{action=People}");
            });

            ImpressoDbContext.CreateAppUserAccount(app.ApplicationServices, Configuration, "Data:AdminUser").Wait();
            ImpressoDbContext.CreateAppUserAccount(app.ApplicationServices, Configuration, "Data:User").Wait();
            ImpressoDbContext.CreateAppUserAccount(app.ApplicationServices, Configuration, "Data:HiringManager").Wait();
        }