Seedowanie

This commit is contained in:
2025-07-16 11:34:03 +02:00
parent 6727cbbe1e
commit 9e00954c29
2 changed files with 49 additions and 1 deletions

View File

@@ -72,7 +72,15 @@ builder.Services.AddSwaggerGen(options =>
options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
});
var app = builder.Build();
var app = builder.Build();
using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
var guhf = scope.ServiceProvider.GetRequiredService<GeneralUseHelpers>();
var seeder = new Seed(db, guhf);
await seeder.SeedAsync();
}
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())