From fe36f9f64db0d251d40a44fab68fe54cfd68121d Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Thu, 28 Mar 2024 17:46:08 -0700 Subject: [PATCH] Remove unnecessary FrozenDictionary --- .../Models/PlacementsDocument.cs | 2 +- .../Services/PlacementProvider.cs | 4 ++-- .../Services/PlacementsManager.cs | 13 +++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Placements/Models/PlacementsDocument.cs b/src/OrchardCore.Modules/OrchardCore.Placements/Models/PlacementsDocument.cs index 71d4582b836..5ceab7e13c9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Placements/Models/PlacementsDocument.cs +++ b/src/OrchardCore.Modules/OrchardCore.Placements/Models/PlacementsDocument.cs @@ -7,6 +7,6 @@ namespace OrchardCore.Placements.Models { public class PlacementsDocument : Document { - public Dictionary Placements { get; set; } = new Dictionary(StringComparer.OrdinalIgnoreCase); + public Dictionary Placements { get; } = new Dictionary(StringComparer.OrdinalIgnoreCase); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementProvider.cs b/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementProvider.cs index 524aa5b121b..b39dd7ed118 100644 --- a/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementProvider.cs @@ -30,11 +30,11 @@ public async Task BuildPlacementInfoResolverAsync(IBuild public class PlacementInfoResolver : IPlacementInfoResolver { - private readonly IReadOnlyDictionary> _placements; + private readonly IReadOnlyDictionary _placements; private readonly IEnumerable _placementNodeFilterProviders; public PlacementInfoResolver( - IReadOnlyDictionary> placements, + IReadOnlyDictionary placements, IEnumerable placementNodeFilterProviders) { _placements = placements; diff --git a/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementsManager.cs b/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementsManager.cs index e9b1295e62d..ce9d47ff7d2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementsManager.cs +++ b/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementsManager.cs @@ -1,4 +1,3 @@ -using System.Collections.Frozen; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -6,21 +5,23 @@ namespace OrchardCore.Placements.Services { - public class PlacementsManager + public sealed class PlacementsManager { private readonly IPlacementStore _placementStore; public PlacementsManager(IPlacementStore placementStore) - => _placementStore = placementStore; + { + _placementStore = placementStore; + } - public async Task>> ListShapePlacementsAsync() + public async Task> ListShapePlacementsAsync() { var document = await _placementStore.GetPlacementsAsync(); - return document.Placements.ToFrozenDictionary(kvp => kvp.Key, kvp => kvp.Value.AsEnumerable()); + return document.Placements; } - public async Task> GetShapePlacementsAsync(string shapeType) + public async Task GetShapePlacementsAsync(string shapeType) { var document = await _placementStore.GetPlacementsAsync();