17 lines
597 B
C#
17 lines
597 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using RpgRoller.Data;
|
|
using RpgRoller.Services;
|
|
|
|
namespace RpgRoller.Hosting;
|
|
|
|
public static class ApplicationInitializationExtensions
|
|
{
|
|
public static void InitializeRpgRollerState(this WebApplication app)
|
|
{
|
|
using var scope = app.Services.CreateScope();
|
|
var dbFactory = scope.ServiceProvider.GetRequiredService<IDbContextFactory<RpgRollerDbContext>>();
|
|
using var db = dbFactory.CreateDbContext();
|
|
SqliteSchemaUpgrader.ApplyPendingChanges(db);
|
|
_ = scope.ServiceProvider.GetRequiredService<IGameService>();
|
|
}
|
|
} |