// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, UserManager <MyMeetupUser> userManager, RoleManager <MyMeetupRole> roleManager, MyMeetupContext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { // app.UseDeveloperExceptionPage(); // app.UseDatabaseErrorPage(); app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } // app.UseDeveloperExceptionPage(); var supportedCultures = new List <CultureInfo> { new CultureInfo("fr"), new CultureInfo("fr-FR"), //new CultureInfo("en"), //new CultureInfo("en-US") }; var localizationOptions = new RequestLocalizationOptions { DefaultRequestCulture = new RequestCulture("fr-FR"), SupportedCultures = supportedCultures, SupportedUICultures = supportedCultures }; app.UseRequestLocalization(localizationOptions); app.UseElmah(); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); context.Database.Migrate(); app.UseAuthentication(); Seeding.SeedRoles(roleManager); Seeding.SeedUsers(userManager); Seeding.SeedData(context); app.UseMvc(routes => { routes.MapRoute( name: "areas", template: "{area:exists}/{controller=Home}/{action=Index}" ); routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, UserManager <AppUser> userManager, RoleManager <AppRole> roleManager, IKategoriService kategoriService, ITagService tagService) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); Seeding.SeedData(userManager, roleManager, kategoriService, tagService).Wait(); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider( Path.Combine(env.ContentRootPath, "wwwroot/AnaKlasor/Resimler")), RequestPath = "/wwwroot/AnaKlasor/Resimler" }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider( Path.Combine(env.ContentRootPath, "wwwroot/AnaKlasor/Yazilar")), RequestPath = "/wwwroot/AnaKlasor/Yazilar" }); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); }); }
protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.ApplyConfiguration(new MessageTypeConfiguration()); Seeding.SeedData(modelBuilder); }