// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { using var serviceScope = app.ApplicationServices .GetRequiredService <IServiceScopeFactory>() .CreateScope(); var service = serviceScope.ServiceProvider; FakeDataSeeder.Seed(service); app.UseDeveloperExceptionPage(); } app.UseDefaultFiles(); app.UseStaticFiles(); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "PaginationDemo v1")); //initialize data seeds using var serviceScope = app.ApplicationServices .GetRequiredService <IServiceScopeFactory>() .CreateScope(); var service = serviceScope.ServiceProvider; FakeDataSeeder.Seed(service); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ItemContext db) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); // initialize data seeds using var serviceScope = app.ApplicationServices .GetRequiredService <IServiceScopeFactory>() .CreateScope(); var service = serviceScope.ServiceProvider; FakeDataSeeder.Seed(service); } db.Database.EnsureCreated(); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }