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
Remove Enabled property from ApplicationInsightsConfig class
support87130bc70d57
diff --git a/src/Core/Grand.Infrastructure/Configuration/ApplicationInsightsConfig.cs b/src/Core/Grand.Infrastructure/Configuration/ApplicationInsightsConfig.csindex 6d6872d97..9081390d3 100644--- a/src/Core/Grand.Infrastructure/Configuration/ApplicationInsightsConfig.cs+++ b/src/Core/Grand.Infrastructure/Configuration/ApplicationInsightsConfig.cs@@ -2,7 +2,6 @@{public class ApplicationInsightsConfig{- public bool Enabled { get; set; }public string ConnectionString { get; set; }}}diff --git a/src/Core/Grand.Infrastructure/Startup/StartupApplication.cs b/src/Core/Grand.Infrastructure/Startup/StartupApplication.csindex 676780a62..b1248f5d4 100644--- a/src/Core/Grand.Infrastructure/Startup/StartupApplication.cs+++ b/src/Core/Grand.Infrastructure/Startup/StartupApplication.cs@@ -55,7 +55,7 @@ namespace Grand.Infrastructure.Startupvar databaseName = mongoUrl.DatabaseName;var clientSettings = MongoClientSettings.FromConnectionString(connectionString);- if (applicationInsights.Enabled)+ if (!string.IsNullOrEmpty(applicationInsights.ConnectionString))clientSettings.ClusterConfigurator = builder => { builder.Subscribe(new ApplicationInsightsSubscriber(serviceCollection)); };serviceCollection.AddScoped(_ => new MongoClient(clientSettings).GetDatabase(databaseName));diff --git a/src/Web/Grand.Web.Admin/App_Data/appsettings.json b/src/Web/Grand.Web.Admin/App_Data/appsettings.jsonindex 39bb7d0e8..1bb20f57e 100644--- a/src/Web/Grand.Web.Admin/App_Data/appsettings.json+++ b/src/Web/Grand.Web.Admin/App_Data/appsettings.json@@ -212,8 +212,6 @@}},"ApplicationInsights": {- "Enabled": false,- "InstrumentationKey": "",- "EnableAdaptiveSampling": false+ "ConnectionString": ""}}\ No newline at end of filediff --git a/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs b/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.csindex 7758c75f7..08614836d 100644--- a/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs+++ b/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs@@ -294,7 +294,7 @@ namespace Grand.Web.Common.Infrastructure{var applicationInsights = new ApplicationInsightsConfig();configuration.GetSection("ApplicationInsights").Bind(applicationInsights);- if (applicationInsights.Enabled)+ if (!string.IsNullOrEmpty(applicationInsights.ConnectionString)){services.AddApplicationInsightsTelemetry();services.AddLogging(builder =>diff --git a/src/Web/Grand.Web.Vendor/App_Data/appsettings.json b/src/Web/Grand.Web.Vendor/App_Data/appsettings.jsonindex 39bb7d0e8..1bb20f57e 100644--- a/src/Web/Grand.Web.Vendor/App_Data/appsettings.json+++ b/src/Web/Grand.Web.Vendor/App_Data/appsettings.json@@ -212,8 +212,6 @@}},"ApplicationInsights": {- "Enabled": false,- "InstrumentationKey": "",- "EnableAdaptiveSampling": false+ "ConnectionString": ""}}\ No newline at end of filediff --git a/src/Web/Grand.Web/App_Data/appsettings.json b/src/Web/Grand.Web/App_Data/appsettings.jsonindex 074083f88..b3d5ae073 100644--- a/src/Web/Grand.Web/App_Data/appsettings.json+++ b/src/Web/Grand.Web/App_Data/appsettings.json@@ -250,7 +250,6 @@}},"ApplicationInsights": {- "Enabled": false,"ConnectionString": ""}}