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
Allow to manage track dependency from MongoDB in ApplicationInsights - add new settings ApplicationInsights:TrackDependencyMongoDb
supportdbdf1abd1d6f
diff --git a/src/Core/Grand.Infrastructure/Configuration/ApplicationInsightsConfig.cs b/src/Core/Grand.Infrastructure/Configuration/ApplicationInsightsConfig.csindex 9081390d3..7580fff64 100644--- a/src/Core/Grand.Infrastructure/Configuration/ApplicationInsightsConfig.cs+++ b/src/Core/Grand.Infrastructure/Configuration/ApplicationInsightsConfig.cs@@ -3,5 +3,6 @@public class ApplicationInsightsConfig{public string ConnectionString { get; set; }+ public bool TrackDependencyMongoDb { get; set; }}}diff --git a/src/Core/Grand.Infrastructure/Startup/StartupApplication.cs b/src/Core/Grand.Infrastructure/Startup/StartupApplication.csindex b1248f5d4..d4d238a73 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 (!string.IsNullOrEmpty(applicationInsights.ConnectionString))+ if (applicationInsights.TrackDependencyMongoDb)clientSettings.ClusterConfigurator = builder => { builder.Subscribe(new ApplicationInsightsSubscriber(serviceCollection)); };serviceCollection.AddScoped(_ => new MongoClient(clientSettings).GetDatabase(databaseName));diff --git a/src/Web/Grand.Web/App_Data/appsettings.json b/src/Web/Grand.Web/App_Data/appsettings.jsonindex a5e135805..7bb66e0b6 100644--- a/src/Web/Grand.Web/App_Data/appsettings.json+++ b/src/Web/Grand.Web/App_Data/appsettings.json@@ -253,7 +253,8 @@}},"ApplicationInsights": {- "ConnectionString": ""+ "ConnectionString": "",+ "TrackDependencyMongoDb": false},//https://github.com/microsoft/ApplicationInsights-Profiler-AspNetCore/blob/main/Configurations.md"ServiceProfiler": {