From 0c51b910ca1cb4413118f53a0d0d718ed7ead806 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Thu, 9 Nov 2023 08:24:29 -0800 Subject: [PATCH 1/2] Initialize logger for Yes SQL to enable logging --- .../OrchardCore.Data.YesSql/OrchardCoreBuilderExtensions.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCoreBuilderExtensions.cs b/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCoreBuilderExtensions.cs index 3c588a89324..47d209ab66b 100644 --- a/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCoreBuilderExtensions.cs +++ b/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCoreBuilderExtensions.cs @@ -3,6 +3,7 @@ using System.Data; using System.IO; using System.Linq; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using OrchardCore.Data; using OrchardCore.Data.Documents; @@ -101,7 +102,7 @@ public static OrchardCoreBuilder AddDataAccess(this OrchardCoreBuilder builder) { var tablePrefix = shellSettings["TablePrefix"].Trim() + databaseTableOptions.TableNameSeparator; - storeConfiguration = storeConfiguration.SetTablePrefix(tablePrefix); + storeConfiguration.SetTablePrefix(tablePrefix); } var store = StoreFactory.Create(storeConfiguration); @@ -170,7 +171,7 @@ public static OrchardCoreBuilder AddDataAccess(this OrchardCoreBuilder builder) return builder; } - private static IConfiguration GetStoreConfiguration(IServiceProvider sp, YesSqlOptions yesSqlOptions, DatabaseTableOptions databaseTableOptions) + private static YesSql.Configuration GetStoreConfiguration(IServiceProvider sp, YesSqlOptions yesSqlOptions, DatabaseTableOptions databaseTableOptions) { var tableNameFactory = sp.GetRequiredService(); @@ -181,6 +182,7 @@ private static IConfiguration GetStoreConfiguration(IServiceProvider sp, YesSqlO ContentSerializer = new PoolingJsonContentSerializer(sp.GetService>()), TableNameConvention = tableNameFactory.Create(databaseTableOptions), IdentityColumnSize = Enum.Parse(databaseTableOptions.IdentityColumnSize), + Logger = sp.GetService>(), }; if (yesSqlOptions.IdGenerator != null) From 668086add855fe84a3dbfb29c34fa349928ce30a Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Thu, 9 Nov 2023 11:23:12 -0800 Subject: [PATCH 2/2] Use YesSql debugger --- .../OrchardCore.Data.YesSql/OrchardCoreBuilderExtensions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCoreBuilderExtensions.cs b/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCoreBuilderExtensions.cs index 47d209ab66b..d00bb6d8585 100644 --- a/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCoreBuilderExtensions.cs +++ b/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCoreBuilderExtensions.cs @@ -174,6 +174,7 @@ public static OrchardCoreBuilder AddDataAccess(this OrchardCoreBuilder builder) private static YesSql.Configuration GetStoreConfiguration(IServiceProvider sp, YesSqlOptions yesSqlOptions, DatabaseTableOptions databaseTableOptions) { var tableNameFactory = sp.GetRequiredService(); + var loggerFactory = sp.GetRequiredService(); var storeConfiguration = new YesSql.Configuration { @@ -182,7 +183,7 @@ private static YesSql.Configuration GetStoreConfiguration(IServiceProvider sp, Y ContentSerializer = new PoolingJsonContentSerializer(sp.GetService>()), TableNameConvention = tableNameFactory.Create(databaseTableOptions), IdentityColumnSize = Enum.Parse(databaseTableOptions.IdentityColumnSize), - Logger = sp.GetService>(), + Logger = loggerFactory.CreateLogger("YesSql"), }; if (yesSqlOptions.IdGenerator != null)