Don't dispose database context for server processes
parent
6b005eb384
commit
09d23bcb78
|
@ -228,8 +228,8 @@ namespace LANCommander
|
||||||
// Migrate
|
// Migrate
|
||||||
Logger.Debug("Migrating database if required");
|
Logger.Debug("Migrating database if required");
|
||||||
await using var scope = app.Services.CreateAsyncScope();
|
await using var scope = app.Services.CreateAsyncScope();
|
||||||
using (var db = scope.ServiceProvider.GetService<DatabaseContext>())
|
using var db = scope.ServiceProvider.GetService<DatabaseContext>();
|
||||||
{
|
|
||||||
if ((await db.Database.GetPendingMigrationsAsync()).Any())
|
if ((await db.Database.GetPendingMigrationsAsync()).Any())
|
||||||
{
|
{
|
||||||
var dataSource = new SqliteConnectionStringBuilder(settings.DatabaseConnectionString).DataSource;
|
var dataSource = new SqliteConnectionStringBuilder(settings.DatabaseConnectionString).DataSource;
|
||||||
|
@ -239,7 +239,6 @@ namespace LANCommander
|
||||||
|
|
||||||
await db.Database.MigrateAsync();
|
await db.Database.MigrateAsync();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Autostart any server processes
|
// Autostart any server processes
|
||||||
Logger.Debug("Autostarting Servers");
|
Logger.Debug("Autostarting Servers");
|
||||||
|
|
Loading…
Reference in New Issue