Reuse Settings_ShellDescriptorRecord during an http request (#8355)

This commit is contained in:
Hermes Sbicego
2020-04-30 19:05:57 +02:00
committed by GitHub
parent b523b342d6
commit c1374f9be9

View File

@@ -13,7 +13,7 @@ namespace Orchard.Core.Settings.Descriptor {
private readonly IRepository<ShellDescriptorRecord> _shellDescriptorRepository;
private readonly IShellDescriptorManagerEventHandler _events;
private readonly ShellSettings _shellSettings;
private ShellDescriptorRecord _shellDescriptorRecord;
public ShellDescriptorManager(
IRepository<ShellDescriptorRecord> 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<ShellFeature> enabledFeatures, IEnumerable<ShellParameter> parameters) {