Skip to content

Commit

Permalink
feat: Add repository context initialization before migration
Browse files Browse the repository at this point in the history
  • Loading branch information
SenexCrenshaw committed Feb 7, 2024
1 parent 8868c0f commit b0d4b44
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions StreamMaster.API/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ void OnShutdown()

//}

RepositoryContextInitializer initialiser = scope.ServiceProvider.GetRequiredService<RepositoryContextInitializer>();
await initialiser.InitialiseAsync().ConfigureAwait(false);
if (app.Environment.IsDevelopment())
{
initialiser.TrySeed();
}

string sqliteDB = Path.Join(BuildInfo.AppDataFolder, "StreamMaster.db");
if (File.Exists(sqliteDB))
Expand All @@ -157,12 +163,7 @@ void OnShutdown()
}
}

RepositoryContextInitializer initialiser = scope.ServiceProvider.GetRequiredService<RepositoryContextInitializer>();
await initialiser.InitialiseAsync().ConfigureAwait(false);
if (app.Environment.IsDevelopment())
{
initialiser.TrySeed();
}

initialiser.MigrateData();

var mem = scope.ServiceProvider.GetRequiredService<IMemoryCache>();
Expand Down

0 comments on commit b0d4b44

Please sign in to comment.