예제 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        //to add the seed data to database we need to add Dbcontext in this method. so first add the argument after env then call the method created in DbSeedingClass
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, LibraryDbContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            context.SeedDataContext();   //call seedDataContext method

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                //we will use mvc controller so replace endpoint.mapget with default route
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller}/{action}/{id?}"
                    );
            });
        }