From 6cf1f03a2bf76f22624ed17f2d74f99bd05bb5eb Mon Sep 17 00:00:00 2001 From: Venkatesan R Date: Mon, 25 Nov 2024 15:00:50 +0530 Subject: [PATCH 1/2] Fixing https://github.com/OrchardCMS/OrchardCore/issues/17054 --- .../Configuration/DatabaseShellConfigurationSources.cs | 4 +--- .../Configuration/DatabaseShellsSettingsSources.cs | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/OrchardCore/OrchardCore.Infrastructure/Shells.Database/Configuration/DatabaseShellConfigurationSources.cs b/src/OrchardCore/OrchardCore.Infrastructure/Shells.Database/Configuration/DatabaseShellConfigurationSources.cs index 04965303430..533c6dccad5 100644 --- a/src/OrchardCore/OrchardCore.Infrastructure/Shells.Database/Configuration/DatabaseShellConfigurationSources.cs +++ b/src/OrchardCore/OrchardCore.Infrastructure/Shells.Database/Configuration/DatabaseShellConfigurationSources.cs @@ -74,9 +74,7 @@ public async Task AddSourcesAsync(string tenant, IConfigurationBuilder builder) if (configuration is not null) { var configurationString = configuration.ToJsonString(JOptions.Default); - using var stream = new MemoryStream(Encoding.UTF8.GetBytes(configurationString)); - - builder.AddTenantJsonStream(stream); + builder.AddTenantJsonStream(new MemoryStream(Encoding.UTF8.GetBytes(configurationString))); } } diff --git a/src/OrchardCore/OrchardCore.Infrastructure/Shells.Database/Configuration/DatabaseShellsSettingsSources.cs b/src/OrchardCore/OrchardCore.Infrastructure/Shells.Database/Configuration/DatabaseShellsSettingsSources.cs index 5e73c9892da..e15c32b12a9 100644 --- a/src/OrchardCore/OrchardCore.Infrastructure/Shells.Database/Configuration/DatabaseShellsSettingsSources.cs +++ b/src/OrchardCore/OrchardCore.Infrastructure/Shells.Database/Configuration/DatabaseShellsSettingsSources.cs @@ -42,9 +42,7 @@ public async Task AddSourcesAsync(IConfigurationBuilder builder) if (document.ShellsSettings is not null) { var shellsSettingsString = document.ShellsSettings.ToJsonString(JOptions.Default); - using var stream = new MemoryStream(Encoding.UTF8.GetBytes(shellsSettingsString)); - - builder.AddTenantJsonStream(stream); + builder.AddTenantJsonStream(new MemoryStream(Encoding.UTF8.GetBytes(shellSettingsString))); } } @@ -55,9 +53,7 @@ public async Task AddSourcesAsync(string tenant, IConfigurationBuilder builder) { var shellSettings = new JsonObject { [tenant] = document.ShellsSettings[tenant] }; var shellSettingsString = shellSettings.ToJsonString(JOptions.Default); - using var stream = new MemoryStream(Encoding.UTF8.GetBytes(shellSettingsString)); - - builder.AddTenantJsonStream(stream); + builder.AddTenantJsonStream(new MemoryStream(Encoding.UTF8.GetBytes(shellSettingsString))); } } From 491818b78e38545d81e74b0f8903a6440cc1a0e3 Mon Sep 17 00:00:00 2001 From: Venkatesan R Date: Mon, 25 Nov 2024 15:07:17 +0530 Subject: [PATCH 2/2] Update DatabaseShellsSettingsSources.cs --- .../Configuration/DatabaseShellsSettingsSources.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OrchardCore/OrchardCore.Infrastructure/Shells.Database/Configuration/DatabaseShellsSettingsSources.cs b/src/OrchardCore/OrchardCore.Infrastructure/Shells.Database/Configuration/DatabaseShellsSettingsSources.cs index e15c32b12a9..f6cfc8072e8 100644 --- a/src/OrchardCore/OrchardCore.Infrastructure/Shells.Database/Configuration/DatabaseShellsSettingsSources.cs +++ b/src/OrchardCore/OrchardCore.Infrastructure/Shells.Database/Configuration/DatabaseShellsSettingsSources.cs @@ -42,7 +42,7 @@ public async Task AddSourcesAsync(IConfigurationBuilder builder) if (document.ShellsSettings is not null) { var shellsSettingsString = document.ShellsSettings.ToJsonString(JOptions.Default); - builder.AddTenantJsonStream(new MemoryStream(Encoding.UTF8.GetBytes(shellSettingsString))); + builder.AddTenantJsonStream(new MemoryStream(Encoding.UTF8.GetBytes(shellsSettingsString))); } }