// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseDeveloperExceptionPage(); #region Entity Context Region - Do Not Delete using (var context = app.ApplicationServices.GetService <VetClinicDbContext>()) { context.Database.EnsureCreated(); #region VetClinicDbContext Seeder Region - Do Not Delete PetSeeder.SeedSamplePetData(app.ApplicationServices.GetService <VetClinicDbContext>()); VetSeeder.SeedSampleVetData(app.ApplicationServices.GetService <VetClinicDbContext>()); CitySeeder.SeedSampleCityData(app.ApplicationServices.GetService <VetClinicDbContext>()); #endregion } #endregion #region Identity Context Region - Do Not Delete var userManager = app.ApplicationServices.GetService <UserManager <ApplicationUser> >(); var roleManager = app.ApplicationServices.GetService <RoleManager <IdentityRole> >(); RoleSeeder.SeedDemoRolesAsync(roleManager); // user seeders -- do not delete this comment pdevitoSeeder.SeedUserAsync(userManager); #endregion app.UseCors("MyCorsPolicy"); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseErrorHandlingMiddleware(); app.UseEndpoints(endpoints => { endpoints.MapHealthChecks("/api/health"); endpoints.MapControllers(); }); #region Dynamic App app.UseSwaggerExtension(); #endregion }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseDeveloperExceptionPage(); #region Entity Context Region - Do Not Delete using (var context = app.ApplicationServices.GetService <VetClinicDbContext>()) { context.Database.EnsureCreated(); #region VetClinicDbContext Seeder Region - Do Not Delete PetSeeder.SeedSamplePetData(app.ApplicationServices.GetService <VetClinicDbContext>()); VetSeeder.SeedSampleVetData(app.ApplicationServices.GetService <VetClinicDbContext>()); CitySeeder.SeedSampleCityData(app.ApplicationServices.GetService <VetClinicDbContext>()); #endregion } #endregion app.UseCors("MyCorsPolicy"); app.UseSerilogRequestLogging(); app.UseRouting(); app.UseErrorHandlingMiddleware(); app.UseEndpoints(endpoints => { endpoints.MapHealthChecks("/api/health"); endpoints.MapControllers(); }); #region Dynamic App app.UseSwaggerExtension(); #endregion }