private async Task SeedDataAsync() { var context = _scope.ServiceProvider.GetService <SqliteContext>(); var service = _scope.ServiceProvider.GetService <IDungeonService>(); var seedData = new ContextSeedData(service, context); await seedData.SeedDataAsync(); }
public void Configure(IApplicationBuilder app, IHostEnvironment env, ContextSeedData seedData) { app.ConfigureDB(Configuration); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); seedData.SeedDataAsync().Wait(); } else { seedData.SeedBaseAsync().Wait(); app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseCookiePolicy(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); }); }