// 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) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); // When you run the app and don't supply any URL segments, it defaults to the "Home" controller and the "Index" method specified above. // The Welcome (in HelloWorldController) method contains a parameter "id" that matched the URL template in the MapRoute method. The trailing ? (in id?) indicates the id parameter is optional. }); DBinitialize.EnsureCreated(app.ApplicationServices); SeedData.Initialize(app.ApplicationServices); }
// 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) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Code}/{action=Index}/{id?}"); }); DBinitialize.EnsureCreated(app.ApplicationServices); }
public static void Main(string[] args) { var host = BuildWebHost(args); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; DBinitialize.EnsureCreated(services); SeedData.Initialize(services); } host.Run(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseSwagger(); app.UseSwaggerUI(options => { options.SwaggerEndpoint("v1/swagger.json", "WP Pod API V1"); }); app.UseMvc(); DBinitialize.EnsureCreated(app.ApplicationServices); DBinitialize.EnsureSeeded(app.ApplicationServices); }
// This method gets called by the runtime. // Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app) { app.UseAuthentication(); app.UseSwagger(); app.UseSwaggerUI(options => { options.SwaggerEndpoint("v1/swagger.json", "Demo Jwt Auth API V1"); }); app.UseMvc(); app.Run(context => { context.Response.Redirect("swagger/"); return(Task.CompletedTask); }); DBinitialize.EnsureCreated(app.ApplicationServices); }
public static void Main(string[] args) { var host = BuildWebHost(args); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { DBinitialize.EnsureCreated(services); SeedData.Initialize(services); } catch (Exception ex) { var logger = services.GetRequiredService <ILogger <Program> >(); logger.LogError(ex, "An error occured creating and seeding the DB."); logger.LogError(ex, "An error occurred seeding the DB."); } } host.Run(); }
// 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(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); using (var scope = app.ApplicationServices.CreateScope()) { var services = scope.ServiceProvider; try { DBinitialize.EnsureCreated(services); SeedData.Initialize(services); } catch (Exception ex) { var logger = services.GetRequiredService <ILogger <Program> >(); logger.LogError(ex, "An error occurred seeding the DB."); } } }
public void Configure(IApplicationBuilder app) { app.UseMvc(); DBinitialize.EnsureCreated(app.ApplicationServices); SeedData.Initialize(app.ApplicationServices); }