コード例 #1
0
ファイル: Startup.cs プロジェクト: mekhalifa/Hospital-App
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env,
                              ApplicationDbContext context, RoleManager <EmployeeRole> roleManager, UserManager <Employee> userManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapRazorPages();
            });

            DemoData.Initialize(context, userManager, roleManager).Wait();
        }