Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Rename settings
support620408781b9b
diff --git a/src/Core/Grand.Infrastructure/Configuration/LiteDbConfig.cs b/src/Core/Grand.Infrastructure/Configuration/DatabaseConfig.cssimilarity index 94%rename from src/Core/Grand.Infrastructure/Configuration/LiteDbConfig.csrename to src/Core/Grand.Infrastructure/Configuration/DatabaseConfig.csindex 4af09cf9b..0563a0e8a 100644--- a/src/Core/Grand.Infrastructure/Configuration/LiteDbConfig.cs+++ b/src/Core/Grand.Infrastructure/Configuration/DatabaseConfig.cs@@ -1,6 +1,6 @@namespace Grand.Infrastructure.Configuration{- public partial class LiteDbConfig+ public partial class DatabaseConfig{/// <summary>/// Gets or sets a value indicating whether use LiteDB database for your applicationdiff --git a/src/Core/Grand.Infrastructure/Startup/StartupApplication.cs b/src/Core/Grand.Infrastructure/Startup/StartupApplication.csindex b9c1702c8..edb02fe6c 100644--- a/src/Core/Grand.Infrastructure/Startup/StartupApplication.cs+++ b/src/Core/Grand.Infrastructure/Startup/StartupApplication.cs@@ -25,20 +25,20 @@ namespace Grand.Infrastructure.Startuppublic void ConfigureServices(IServiceCollection services, IConfiguration configuration){- var config = new LiteDbConfig();- configuration.GetSection("LiteDb").Bind(config);+ var config = new DatabaseConfig();+ configuration.GetSection("Database").Bind(config);RegisterDataLayer(services, config);}- private void RegisterDataLayer(IServiceCollection serviceCollection, LiteDbConfig litedbConfig)+ private void RegisterDataLayer(IServiceCollection serviceCollection, DatabaseConfig dbConfig){var dataProviderSettings = DataSettingsManager.LoadSettings();if (string.IsNullOrEmpty(dataProviderSettings.ConnectionString)){serviceCollection.AddTransient(c => dataProviderSettings);- if(litedbConfig.UseLiteDb)- serviceCollection.AddSingleton(c => new LiteDatabase(litedbConfig.LiteDbConnectionString));+ if(dbConfig.UseLiteDb)+ serviceCollection.AddSingleton(c => new LiteDatabase(dbConfig.LiteDbConnectionString));}if (dataProviderSettings != null && dataProviderSettings.IsValid()){@@ -53,14 +53,14 @@ namespace Grand.Infrastructure.Startup}else{- if(litedbConfig.Singleton)+ if(dbConfig.Singleton)serviceCollection.AddSingleton(c => new LiteDatabase(dataProviderSettings.ConnectionString) { UtcDate = true });elseserviceCollection.AddScoped(c => new LiteDatabase(dataProviderSettings.ConnectionString) { UtcDate = true });}}- if (!litedbConfig.UseLiteDb)+ if (!dbConfig.UseLiteDb){//database contextserviceCollection.AddScoped<IDatabaseContext, MongoDBContext>();diff --git a/src/Core/Grand.Infrastructure/StartupBase.cs b/src/Core/Grand.Infrastructure/StartupBase.csindex 69cac6c6c..2ddbdd174 100644--- a/src/Core/Grand.Infrastructure/StartupBase.cs+++ b/src/Core/Grand.Infrastructure/StartupBase.cs@@ -199,7 +199,7 @@ namespace Grand.Infrastructureservices.StartupConfig<RabbitConfig>(configuration.GetSection("Rabbit"));services.StartupConfig<ApiConfig>(configuration.GetSection("Api"));services.StartupConfig<GrandWebApiConfig>(configuration.GetSection("GrandWebApi"));- services.StartupConfig<LiteDbConfig>(configuration.GetSection("LiteDb"));+ services.StartupConfig<DatabaseConfig>(configuration.GetSection("Database"));services.StartupConfig<AmazonConfig>(configuration.GetSection("Amazon"));services.StartupConfig<AzureConfig>(configuration.GetSection("Azure"));diff --git a/src/Web/Grand.Web/App_Data/appsettings.json b/src/Web/Grand.Web/App_Data/appsettings.jsonindex fdadb6e72..d4ed03d69 100644--- a/src/Web/Grand.Web/App_Data/appsettings.json+++ b/src/Web/Grand.Web/App_Data/appsettings.json@@ -34,6 +34,15 @@"UseSerilogRequestLogging": false},+ "Database": {+ //This setting is required to use LiteDB database+ "UseLiteDb": false,+ //LiteDB database as a singleton service in the application+ "Singleton": true,+ //Init connection string - it's required only for the installation process!+ "LiteDbConnectionString": "Filename=App_Data/database.db"+ },+"Security": {//Use a reverse proxy server - more information you can find at: https://docs.microsoft.com/en-US/aspnet/core/host-and-deploy/linux-nginx@@ -189,14 +198,6 @@"ClientId": "","ClientSecret": ""},- "LiteDb": {- //This setting is required to use LiteDB database- "UseLiteDb": false,- //LiteDB database as a singleton service in the application- "Singleton": true,- //Init connection string - it's required only for the installation process!- "LiteDbConnectionString": "Filename=App_Data/database.db"- },//access to the api to web controllers"GrandWebApi": {diff --git a/src/Web/Grand.Web/Controllers/InstallController.cs b/src/Web/Grand.Web/Controllers/InstallController.csindex ee16d3aa3..09348b8de 100644--- a/src/Web/Grand.Web/Controllers/InstallController.cs+++ b/src/Web/Grand.Web/Controllers/InstallController.cs@@ -28,7 +28,7 @@ namespace Grand.Web.Controllersprivate readonly IServiceProvider _serviceProvider;private readonly IHostApplicationLifetime _applicationLifetime;private readonly IMediator _mediator;- private readonly LiteDbConfig _litedbConfig;+ private readonly DatabaseConfig _dbConfig;/// <summary>/// Cookie name to language for the installation page@@ -44,13 +44,13 @@ namespace Grand.Web.ControllersIHostApplicationLifetime applicationLifetime,IServiceProvider serviceProvider,IMediator mediator,- LiteDbConfig litedbConfig)+ DatabaseConfig litedbConfig){_cacheBase = cacheBase;_applicationLifetime = applicationLifetime;_serviceProvider = serviceProvider;_mediator = mediator;- _litedbConfig = litedbConfig;+ _dbConfig = litedbConfig;}#endregion@@ -163,13 +163,13 @@ namespace Grand.Web.Controllers}else{- if (!_litedbConfig.UseLiteDb)+ if (!_dbConfig.UseLiteDb)ModelState.AddModelError("", locService.GetResource(model.SelectedLanguage, "InfoLiteDb"));- if (string.IsNullOrEmpty(_litedbConfig.LiteDbConnectionString))+ if (string.IsNullOrEmpty(_dbConfig.LiteDbConnectionString))ModelState.AddModelError("", locService.GetResource(model.SelectedLanguage, "InfoLiteDbConnectionString"));- connectionString = _litedbConfig.LiteDbConnectionString;+ connectionString = _dbConfig.LiteDbConnectionString;}}return connectionString;@@ -177,11 +177,11 @@ namespace Grand.Web.Controllersprotected async Task CheckConnectionString(IInstallationLocalizedService locService, string connectionString, InstallModel model){- if (!_litedbConfig.UseLiteDb && model.DataProvider == DbProvider.LiteDB)+ if (!_dbConfig.UseLiteDb && model.DataProvider == DbProvider.LiteDB){ModelState.AddModelError("", locService.GetResource(model.SelectedLanguage, "UseLiteDbEnable"));}- if (_litedbConfig.UseLiteDb && model.DataProvider != DbProvider.LiteDB)+ if (_dbConfig.UseLiteDb && model.DataProvider != DbProvider.LiteDB){ModelState.AddModelError("", locService.GetResource(model.SelectedLanguage, "UseLiteDbDisable"));}