From c1374f9be9150b131b1ce3157a760438630ba558 Mon Sep 17 00:00:00 2001 From: Hermes Sbicego Date: Thu, 30 Apr 2020 19:05:57 +0200 Subject: [PATCH] Reuse Settings_ShellDescriptorRecord during an http request (#8355) --- .../Core/Settings/Descriptor/ShellDescriptorManager.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Core/Settings/Descriptor/ShellDescriptorManager.cs b/src/Orchard.Web/Core/Settings/Descriptor/ShellDescriptorManager.cs index faf80b3ec..7fd7dcbd4 100644 --- a/src/Orchard.Web/Core/Settings/Descriptor/ShellDescriptorManager.cs +++ b/src/Orchard.Web/Core/Settings/Descriptor/ShellDescriptorManager.cs @@ -13,7 +13,7 @@ namespace Orchard.Core.Settings.Descriptor { private readonly IRepository _shellDescriptorRepository; private readonly IShellDescriptorManagerEventHandler _events; private readonly ShellSettings _shellSettings; - + private ShellDescriptorRecord _shellDescriptorRecord; public ShellDescriptorManager( IRepository shellDescriptorRepository, IShellDescriptorManagerEventHandler events, @@ -51,7 +51,10 @@ namespace Orchard.Core.Settings.Descriptor { } private ShellDescriptorRecord GetDescriptorRecord() { - return _shellDescriptorRepository.Get(x => x != null); + if (_shellDescriptorRecord == null) { + _shellDescriptorRecord = _shellDescriptorRepository.Get(x => x != null); + } + return _shellDescriptorRecord; } public void UpdateShellDescriptor(int priorSerialNumber, IEnumerable enabledFeatures, IEnumerable parameters) {