From 8e88b322972088375c41edd30b7f42d687675ea7 Mon Sep 17 00:00:00 2001 From: support Date: Thu, 29 Oct 2026 19:45:45 +0100 Subject: [PATCH] Fix installing on LiteDB CreateTables opened a database context before checking the provider. For LiteDB that is a second LiteDatabase on the file the one registered in DI already holds, so the installation failed with "being used by another process". The context is only needed for MongoDB and is now created there. --- .../Grand.Module.Installer/Services/InstallationService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Modules/Grand.Module.Installer/Services/InstallationService.cs b/src/Modules/Grand.Module.Installer/Services/InstallationService.cs index 64a89f9fe..d22ee6ff3 100644 --- a/src/Modules/Grand.Module.Installer/Services/InstallationService.cs +++ b/src/Modules/Grand.Module.Installer/Services/InstallationService.cs @@ -1048,9 +1048,10 @@ private async Task CreateTables(string? local) { var configuration = _serviceProvider.GetRequiredService(); var dataSettings = DataSettingsManager.Instance.LoadSettings(true); - var dbContext = _serviceProvider.GetRequiredService().GetDatabaseContext(configuration[SettingsConstants.ConnectionStrings]); + //LiteDB has no tables to create, and a second LiteDatabase on the same file fails on its lock if (dataSettings.DbProvider != DbProvider.LiteDB) { + var dbContext = _serviceProvider.GetRequiredService().GetDatabaseContext(configuration[SettingsConstants.ConnectionStrings]); var typeSearcher = _serviceProvider.GetRequiredService(); var q = typeSearcher.GetAssemblies().FirstOrDefault(x => x.GetName().Name == "Grand.Domain");