// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, HwtaDbContext context) { context.Database.Migrate(); var dbSeed = new DataBaseSeed(context); dbSeed.Seed(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "HWTA_Web v1"); }); app.UseRouting(); app.UseCors(builder => builder.SetIsOriginAllowed(_ => true) .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials()); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapDefaultControllerRoute(); }); }
protected override void OnModelCreating(ModelBuilder modelBuilder) { DataBaseSeed.Seed(modelBuilder); base.OnModelCreating(modelBuilder); }