// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, WorldContextSeedData seed, ILoggerFactory loggerFactory) { loggerFactory.AddDebug(LogLevel.Information); //app.UseDefaultFiles(); app.UseStaticFiles(); app.UseMvc(config => { config.MapRoute( name: "default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); seed.EnsuredSeeded(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure( IApplicationBuilder app, ILoggerFactory loggerFactory, WorldContextSeedData seeder, ILoggerFactory factory) { Mapper.Initialize(config => { config.CreateMap <TripViewModel, Trip>().ReverseMap(); config.CreateMap <StopViewModel, Stop>().ReverseMap(); }); loggerFactory.AddConsole(); if (_env.IsDevelopment()) { app.UseDeveloperExceptionPage(); factory.AddDebug(LogLevel.Information); } else { factory.AddDebug(LogLevel.Error); } app.UseStaticFiles(); app.UseIdentity(); app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); seeder.EnsureSeedData().Wait(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, WorldContextSeedData seeder) { app.UseStaticFiles(); app.UseIdentity(); // AutoMapper can map TripViewModel -> Trip // Trip -> TripViewModel (using a .ReverseMap() call) // AutoMapper automatically creates maps from a collection of viewmodels to a collection of entities too Mapper.Initialize(config => { config.CreateMap <TripViewModel, Trip>().ReverseMap(); config.CreateMap <StopViewModel, Stop>().ReverseMap(); }); loggerFactory.AddConsole(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); loggerFactory.AddDebug(LogLevel.Information); } else { loggerFactory.AddDebug(LogLevel.Error); } app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" }); }); seeder.EnsureSeedData().Wait(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app, WorldContextSeedData seeder, ILoggerFactory loggerFactory, IHostingEnvironment env) { if (env.IsDevelopment()) { loggerFactory.AddDebug(LogLevel.Information); app.UseDeveloperExceptionPage(); } else { loggerFactory.AddDebug(LogLevel.Error); app.UseExceptionHandler("/App/Error"); } loggerFactory.AddDebug(LogLevel.Warning); app.UseStaticFiles(); app.UseIdentity(); Mapper.Initialize(config => { config.CreateMap <Trip, TripViewModel>().ReverseMap(); config.CreateMap <Stop, StopViewModel>().ReverseMap(); }); app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); await seeder.EnsureSeedDataAsync(); }
public async Task Configure(IApplicationBuilder app, WorldContextSeedData seeder, IHostingEnvironment env) { app.UseStaticFiles(); app.UseIdentity(); app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); Mapper.Initialize(config => { config.CreateMap <Trip, TripViewModel>().ReverseMap(); config.CreateMap <Stop, StopViewModel>().ReverseMap(); }); await seeder.EnsureSeedDataAsync(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, WorldContextSeedData seeder, ILoggerFactory loggerFactory) { loggerFactory.AddDebug(LogLevel.Warning); app.UseStaticFiles(); Mapper.Initialize(config => { config.CreateMap<Trip, TripViewModel>().ReverseMap(); config.CreateMap<Stop, StopViewModel>().ReverseMap(); }); app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new {controller = "App", action = "Index"} ); }); seeder.EnsureSeedData(); }
public async void Configure(IApplicationBuilder app, WorldContextSeedData seeder, ILoggerFactory loggerFactory) { loggerFactory.AddDebug(LogLevel.Warning); app.UseStaticFiles(); app.UseIdentity(); Mapper.Initialize(config => { config.CreateMap <Trip, TripViewModel>().ReverseMap(); config.CreateMap <Stop, StopViewModel>().ReverseMap(); }); app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" }); }); await seeder.EnsureSeedData(); }
// This method gets called by the runtime. //Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app, WorldContextSeedData seeder, ILoggerFactory loggerFactory) { loggerFactory.AddDebug(LogLevel.Warning); //app.UseDefaultFiles(); app.UseStaticFiles(); //order matters in middleware app.UseIdentity(); AutoMapper.Mapper.Initialize(config => { config.CreateMap <Trip, TripViewModel>().ReverseMap(); config.CreateMap <Stop, StopViewModel>().ReverseMap(); }); app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "index" } ); }); //looks for requests in the style of mvc await seeder.EnsureSeedDataAsync(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app, WorldContextSeedData seeder, ILoggerFactory logFactory) { logFactory.AddDebug(LogLevel.Information); app.UseStaticFiles(); app.UseIdentity(); Mapper.Initialize(conf => { conf.CreateMap <Trip, TripModelView>().ReverseMap(); conf.CreateMap <Stop, StopModelView>().ReverseMap(); } //createMap<src,dest>(); ); app.UseCookieAuthentication(opt => { opt.LoginPath = new PathString("/Account/Login"); }); app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); await seeder.EnsureDataWithAsync(); //app.UseIISPlatformHandler(); //app.Run(async (context) => //{ // await context.Response.WriteAsync("Hello World!"); //}); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, WorldContextSeedData seeder, ILoggerFactory factory) { Mapper.Initialize(config => { config.CreateMap <TripViewModel, Trip>().ReverseMap(); config.CreateMap <StopViewModel, Stop>().ReverseMap(); }); loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); factory.AddDebug(LogLevel.Information); } else { factory.AddDebug(LogLevel.Error); app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); seeder.EnsureSeedData().Wait(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, WorldContextSeedData seederData, ILoggerFactory factory) { Mapper.Initialize(config => { config.CreateMap <TripViewModel, Trip>().ReverseMap(); config.CreateMap <StopViewModel, Stop>().ReverseMap(); }); //#if DEBUG if (env.IsEnvironment("Development")) { app.UseDeveloperExceptionPage(); factory.AddDebug(LogLevel.Information); } //#endif else { factory.AddDebug(LogLevel.Error); } app.UseStaticFiles(); app.UseAuthentication(); app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); //TODO:Essa porra de seeder da pau quando for usar migrations, quando for atualizar o banco //Ou seja, quando precisar atualizar comentar essa merda seederData.EnsureSeedData().Wait(); }
public void Configure(IApplicationBuilder app, WorldContextSeedData seeder, ILoggerFactory loggerFactory) { loggerFactory.AddDebug(LogLevel.Warning); app.UseStaticFiles(); app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); // Add the platform handler to the request pipeline. //app.UseIISPlatformHandler(); //app.Run(async (context) => //{ // await context.Response.WriteAsync("Hello World!"); //}); seeder.EnsureSeedData(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app, WorldContextSeedData seeder, ILoggerFactory loggerFactory, IHostingEnvironment environment) { if (environment.IsDevelopment()) { loggerFactory.AddDebug(LogLevel.Information); app.UseDeveloperExceptionPage(); } else { loggerFactory.AddDebug(LogLevel.Error); app.UseExceptionHandler("/App/Error"); } app.UseStaticFiles(); app.UseIdentity(); Mapper.Initialize(config => { config.CreateMap<Trip, TripViewModel>().ReverseMap(); config.CreateMap<Stop, StopViewModel>().ReverseMap(); }); app.UseMvc(config => { config.MapRoute("Default", "{controller}/{action}/{id?}", new { controller = "App", action = "Index" } ); }); await seeder.EnsureSeedDataAsync(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, WorldContextSeedData seeder) { loggerFactory.AddConsole(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); loggerFactory.AddDebug(LogLevel.Information); } else { loggerFactory.AddDebug(LogLevel.Error); } app.UseStaticFiles(); app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); seeder.EnsureSeedData().Wait(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, WorldContextSeedData seeder) { Mapper.Initialize(config => { config.CreateMap <TripViewModel, Trip>().ReverseMap(); // o reverse map permite criar um viewmodel atraves de uma trip existente... config.CreateMap <StopViewModel, Stop>().ReverseMap(); }); loggerFactory.AddConsole(); if (env.IsDevelopment()) { loggerFactory.AddDebug(LogLevel.Information); app.UseDeveloperExceptionPage(); //injeta a funcao de mostrar a lista de erros na tela } else { loggerFactory.AddDebug(LogLevel.Error); } app.UseStaticFiles(); app.UseIdentity(); //após configurar la em cima, aqui pedimos ao sistema para usar o serviço app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); seeder.EnsureSeedData().Wait(); //app.UseDefaultFiles(); //app.Run(async (context) => //{ // await context.Response.WriteAsync("Hello World!"); //}); }
//This method is invoked when ASPNET_ENV is 'Development' or is not defined //The allowed values are Development,Staging and Production public async void ConfigureDevelopment(IApplicationBuilder app, ILoggerFactory loggerFactory, WorldContextSeedData seeder, IHostingEnvironment env) { loggerFactory.AddConsole(minLevel: LogLevel.Verbose); // StatusCode pages to gracefully handle status codes 400-599. //app.UseStatusCodePagesWithRedirects("~/Home/StatusCodePage"); // Display custom error page in production when error occurs // During development use the ErrorPage middleware to display error information in the browser app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); // Add the runtime information page that can be used by developers // to see what packages are used by the application // default path is: /runtimeinfo app.UseRuntimeInfoPage(); await Configure(app, seeder, env); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, WorldContextSeedData seeder) { //loggerFactory.AddConsole(); loggerFactory.AddDebug(LogLevel.Warning); //if (env.IsDevelopment()) if (env.IsEnvironment("Development")) { app.UseDeveloperExceptionPage(); } //app.Run(async (context) => //{ // await context.Response.WriteAsync("Hello World!"); //}); // This is to serve html,css, js from wwwwroot folder //app.UseDefaultFiles(); app.UseStaticFiles(); app.UseIdentity(); Mapper.Initialize(config => { config.CreateMap <Trip, TripViewModel>().ReverseMap(); config.CreateMap <Stop, StopViewModel>().ReverseMap(); }); // Setting up MVC with a route app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); } ); // This is seeding the database await seeder.EnsureSeedDataAsync(); }
//This method is invoked when ASPNET_ENV is 'Production' //The allowed values are Development,Staging and Production public async void ConfigureProduction(IApplicationBuilder app, ILoggerFactory loggerFactory, WorldContextSeedData seeder, IHostingEnvironment env) { loggerFactory.AddConsole(minLevel: LogLevel.Warning); // StatusCode pages to gracefully handle status codes 400-599. app.UseStatusCodePagesWithRedirects("~/Home/StatusCodePage"); app.UseExceptionHandler("/Home/Error"); await Configure(app, seeder, env); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory factory, WorldContextSeedData seeder) { app.UseStaticFiles(); app.UseIdentity(); //loggerFactory.AddConsole(); Mapper.Initialize(config => { config.CreateMap <TripViewModel, Trip>().ReverseMap(); config.CreateMap <StopViewModel, Stop>().ReverseMap(); }); if (env.IsEnvironment("Development")) { app.UseDeveloperExceptionPage(); factory.AddDebug(LogLevel.Information); } else { factory.AddDebug(LogLevel.Error); } //app.Run(async (context) => //{ // await context.Response.WriteAsync("Hello World!"); //}); app.UseMvc(routes => { routes.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); seeder.EnsureSeedData().Wait(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, WorldContextSeedData seeder) { Mapper.Initialize(config => { config.CreateMap <TripViewModel, Trip>().ReverseMap(); config.CreateMap <StopViewModel, Stop>().ReverseMap(); }); // "Production" may not be setup at the moment. if (env.IsProduction() == false) { app.UseDeveloperExceptionPage(); loggerFactory.AddDebug(LogLevel.Information); } else { loggerFactory.AddDebug(LogLevel.Error); } app.UseStaticFiles(); app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" }); }); seeder.EnsureSeeData().Wait(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, WorldContextSeedData seeder) { loggerFactory.AddConsole(); if (_env.IsDevelopment()) { app.UseDeveloperExceptionPage(); loggerFactory.AddDebug(LogLevel.Information); } else { loggerFactory.AddDebug(LogLevel.Error); } //Middlewares app.UseStaticFiles(); app.UseIdentity(); Mapper.Initialize(config => { config.CreateMap <TripViewModel, Trip>() .ForMember(dest => dest.DateCreated, opt => opt.MapFrom(src => src.Created)).ReverseMap(); config.CreateMap <StopViewModel, Stop>().ReverseMap(); }); app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller=App}/{action=Index}/{id?}"); }); await seeder.EnsureSeedDataAsync(); }
public async void Configure(IApplicationBuilder app, WorldContextSeedData seeder, ILoggerFactory loggerFactory) { app.UseStaticFiles(); app.UseSession(); app.UseIdentity(); app.UseCookieAuthentication(config => { config.LoginPath = "/Auth/Login"; config.CookieName = "TheWorldAuth"; config.AutomaticAuthenticate = true; config.AutomaticChallenge = true; config.Events = new CookieAuthenticationEvents() { OnRedirectToLogin = ctx => { if (ctx.Request.Path.StartsWithSegments("/api") && ctx.Response.StatusCode == 200) { ctx.Response.StatusCode = (int)HttpStatusCode.Unauthorized; return(Task.FromResult <object>(null)); } else { ctx.Response.Redirect(ctx.RedirectUri); return(Task.FromResult <object>(null)); } } }; }); if (_hostingEnvironment.IsDevelopment()) { loggerFactory.AddDebug(LogLevel.Information); app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(config => { config.EnableAll(); }); } else { loggerFactory.AddDebug(LogLevel.Debug); } app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear()); await seeder.EnsureSeedDataAsync(); Mapper.Initialize(config => { config.CreateMap <TripViewModel, Trip>().ReverseMap(); config.CreateMap <StopViewModel, Stop>().ReverseMap(); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, WorldContextSeedData seeder) { app.UseIISPlatformHandler(); app.UseDeveloperExceptionPage(); //app.UseGlobalExceptionHandler(); app.UseIdentity(); //loggerFactory.AddConsole(Configuration.GetSection("Logging")); //loggerFactory.AddDebug(LogLevel.Debug); // if (env.IsDevelopment()) // { // app.UseDeveloperExceptionPage(); // } // else // { // app.UseExceptionHandler("/Home/Error"); //} app.UseRuntimeInfoPage("/info"); app.UseFileServer(); // Includes both middlewares below in the right order //app.UseDefaultFiles(); //app.UseStaticFiles(); // Files in wwwroot like images, html pages .etc Mapper.Initialize(config => { config.AddProfile <TripProfile>(); config.AddProfile <StopProfile>(); }); // Usually put this after serving static files. app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=App}/{action=Index}/{id?}"); // defaults: new { controller = "App", action = "Index" }; }); await seeder.EnsureSeedDataAsync(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, WorldContextSeedData seeder) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); loggerFactory.AddDebug(LogLevel.Information); } else { loggerFactory.AddDebug(LogLevel.Error); } app.UseStaticFiles(); app.UseMvc(configure => { configure.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); seeder.EnsureSeedData().Wait(); //default code from creating the project //loggerFactory.AddConsole(); //if (env.IsDevelopment()) //{ // app.UseDeveloperExceptionPage(); //} //app.Run(async (context) => //{ // await context.Response.WriteAsync("Hello World!"); //}); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, WorldContextSeedData seeder, ILoggerFactory factory) { // Configuring AutoMapper mapping Mapper.Initialize(config => { config.CreateMap <TripViewModel, Trip>().ReverseMap(); config.CreateMap <StopViewModel, Stop>().ReverseMap(); }); // Error page. For debugging if (env.IsEnvironment("Development")) { app.UseDeveloperExceptionPage(); // Note: AddDebug is part of Microsoft.Extensions.Logging.Debug factory.AddDebug(LogLevel.Information); } else { factory.AddDebug(LogLevel.Error); } // Returning HTML content //app.Run(async (context) => //{ // await context.Response.WriteAsync("<html><body><h3>Hello World!</h3></body></html>"); //}); // Using static files (Microsoft.AspNetCore.StaticFiles) //app.UseDefaultFiles(); app.UseStaticFiles(); // Use ASP .Net Core Identity app.UseIdentity(); // Using MVC (Microsoft.AspNetCore.Mvc) app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" }); }); // Seed the database seeder.EnsureSeedData().Wait(); }