Fixed removing temp. database file when importing JSON
This commit is contained in:
3 files changed
+46
-32
No files matched your search
@@ -60,30 +60,31 @@ internal static class Program
|
||||
}
|
||||
});
|
||||
|
||||
// Tear down the setup:
|
||||
using var setupMaintenance = Setup.Maintenance;
|
||||
|
||||
// Get the host out of the DI system:
|
||||
var host = builder.Build();
|
||||
|
||||
// Create a service scope:
|
||||
using (var scope = host.Services.CreateScope())
|
||||
using (var host = builder.Build())
|
||||
{
|
||||
// Get a service provider:
|
||||
SERVICE_PROVIDER = scope.ServiceProvider;
|
||||
|
||||
// Set the service provider to the processor:
|
||||
ProcessorMeta.ServiceProvider = SERVICE_PROVIDER;
|
||||
|
||||
// Apply database migrations:
|
||||
using (var database = SERVICE_PROVIDER.GetRequiredService<DataContext>())
|
||||
Setup.PerformDataMigration(database).Wait();
|
||||
|
||||
// Start the app:
|
||||
do
|
||||
// Create a service scope:
|
||||
using (var scope = host.Services.CreateScope())
|
||||
{
|
||||
Application.Run(new Main());
|
||||
} while (Program.RestartMainApp);
|
||||
// Get a service provider:
|
||||
SERVICE_PROVIDER = scope.ServiceProvider;
|
||||
|
||||
// Set the service provider to the processor:
|
||||
ProcessorMeta.ServiceProvider = SERVICE_PROVIDER;
|
||||
|
||||
// Apply database migrations:
|
||||
using (var database = SERVICE_PROVIDER.GetRequiredService<DataContext>())
|
||||
Setup.PerformDataMigration(database).Wait();
|
||||
|
||||
// Start the app:
|
||||
do
|
||||
{
|
||||
Application.Run(new Main());
|
||||
} while (Program.RestartMainApp);
|
||||
}
|
||||
}
|
||||
|
||||
// Tear down the setup:
|
||||
AppDomain.CurrentDomain.ProcessExit += (sender, eventArgs) => Setup.SETUP_MAINTENANCE.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user