public Form1() { InitializeComponent(); _context = new MyContext(); DbSeeder.SeedDatabase(_context); DataLoad(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, DbSeeder seeder) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); seeder.SeedDatabase().Wait(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, DbSeeder seeder) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } //app.UseRouting(); app.UseStaticFiles(); // middle ware to use static files app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Account}/{action=Login}/{id?}"); // default page }); seeder.SeedDatabase().Wait(); // seeding //app.UseEndpoints(endpoints => //{ // endpoints.MapGet("/", async context => // { // await context.Response.WriteAsync("Hello World!"); // }); //}); }
protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.ApplyConfiguration(new TopicConfiguration()); modelBuilder.ApplyConfiguration(new ThreadConfiguration()); modelBuilder.ApplyConfiguration(new PostConfiguration()); modelBuilder.ApplyConfiguration(new NotificationConfiguration()); modelBuilder.ApplyConfiguration(new UserProfileConfiguration()); DbSeeder.SeedDatabase(modelBuilder); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, DbSeeder seeder) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStaticFiles(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Account}/{action=Login}/{id?}"); }); seeder.SeedDatabase().Wait(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, DbSeeder seeder) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); seeder.SeedDatabase().Wait(); //app.Run(async (context) => //{ // await context.Response.WriteAsync("Hello World!"); //}); }
// HTTP processing pipeline을 설정해주는 곳 // 어떤 웹요청이 들어왔을 때 어떻게 듣고, 어떤 식으로 진행할 것인가를 정의해주는 곳 public void Configure(IApplicationBuilder app, IHostingEnvironment env, DbSeeder seeder) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } /* * app.Run(async (context) => * { * await context.Response.WriteAsync("Hello World!"); * }); */ //wwwroot의 Static File을 사용함 app.UseStaticFiles(); /* * 인증서비스 활성화 * UseMvc 위에 선언해주어야 함 */ app.UseAuthentication(); /* * Routing MiddleWare Setting * Mvc에서는 Url의 패턴을 보고 Routing을 결정함 * 매개변수 뒤에 ?를 추가함으로써 선택적인 매개변수가 됨 * ex. /Home/Student, /Home/Student/2 모두 가능 */ app.UseMvc(routes => { routes.MapRoute( name: "default", //template: "{controller}/{action}/{id?}" //웹사이트 접속시 첫화면 설정(HomeController > Index 실행화면) template: "{controller=Account}/{action=Login}/{id?}" ); }); seeder.SeedDatabase().Wait(); }