Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary FrozenDictionary #15623

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ namespace OrchardCore.Placements.Models
{
public class PlacementsDocument : Document
{
public Dictionary<string, PlacementNode[]> Placements { get; set; } = new Dictionary<string, PlacementNode[]>(StringComparer.OrdinalIgnoreCase);
public Dictionary<string, PlacementNode[]> Placements { get; } = new Dictionary<string, PlacementNode[]>(StringComparer.OrdinalIgnoreCase);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public async Task<IPlacementInfoResolver> BuildPlacementInfoResolverAsync(IBuild

public class PlacementInfoResolver : IPlacementInfoResolver
{
private readonly IReadOnlyDictionary<string, IEnumerable<PlacementNode>> _placements;
private readonly IReadOnlyDictionary<string, PlacementNode[]> _placements;
private readonly IEnumerable<IPlacementNodeFilterProvider> _placementNodeFilterProviders;

public PlacementInfoResolver(
IReadOnlyDictionary<string, IEnumerable<PlacementNode>> placements,
IReadOnlyDictionary<string, PlacementNode[]> placements,
IEnumerable<IPlacementNodeFilterProvider> placementNodeFilterProviders)
{
_placements = placements;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using OrchardCore.DisplayManagement.Descriptors.ShapePlacementStrategy;

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<IReadOnlyDictionary<string, IEnumerable<PlacementNode>>> ListShapePlacementsAsync()
public async Task<IReadOnlyDictionary<string, PlacementNode[]>> ListShapePlacementsAsync()
{
var document = await _placementStore.GetPlacementsAsync();

return document.Placements.ToFrozenDictionary(kvp => kvp.Key, kvp => kvp.Value.AsEnumerable());
return document.Placements;
}

public async Task<IEnumerable<PlacementNode>> GetShapePlacementsAsync(string shapeType)
public async Task<PlacementNode[]> GetShapePlacementsAsync(string shapeType)
{
var document = await _placementStore.GetPlacementsAsync();

Expand Down
Loading