From e655767d31a2e6ce3bf5f47ad0a7db4175efe82f Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Sat, 23 Dec 2023 20:55:21 -0500 Subject: [PATCH] Use `FrozenDictionary` where appropriate --- .../Components/Engine/DelegatingEngineInstaller.cs | 8 ++++---- src/Tgstation.Server.Host/Core/Application.cs | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Tgstation.Server.Host/Components/Engine/DelegatingEngineInstaller.cs b/src/Tgstation.Server.Host/Components/Engine/DelegatingEngineInstaller.cs index c7c5363a95..1157dff565 100644 --- a/src/Tgstation.Server.Host/Components/Engine/DelegatingEngineInstaller.cs +++ b/src/Tgstation.Server.Host/Components/Engine/DelegatingEngineInstaller.cs @@ -1,5 +1,5 @@ using System; -using System.Collections.Generic; +using System.Collections.Frozen; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -15,15 +15,15 @@ namespace Tgstation.Server.Host.Components.Engine sealed class DelegatingEngineInstaller : IEngineInstaller { /// - /// The mapping s to their appropriate . + /// The mapping s to their appropriate . /// - readonly IReadOnlyDictionary delegatedInstallers; + readonly FrozenDictionary delegatedInstallers; /// /// Initializes a new instance of the class. /// /// The value of . - public DelegatingEngineInstaller(IReadOnlyDictionary delegatedInstallers) + public DelegatingEngineInstaller(FrozenDictionary delegatedInstallers) { this.delegatedInstallers = delegatedInstallers ?? throw new ArgumentNullException(nameof(delegatedInstallers)); } diff --git a/src/Tgstation.Server.Host/Core/Application.cs b/src/Tgstation.Server.Host/Core/Application.cs index 202b098d7c..3b80d9da38 100644 --- a/src/Tgstation.Server.Host/Core/Application.cs +++ b/src/Tgstation.Server.Host/Core/Application.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Frozen; using System.Collections.Generic; using System.Globalization; using System.Threading.Tasks; @@ -380,12 +381,13 @@ namespace Tgstation.Server.Host.Core openDreamRepositoryDirectory), new NoopEventConsumer())); - services.AddSingleton>( + services.AddSingleton( serviceProvider => new Dictionary { { EngineType.Byond, serviceProvider.GetRequiredService() }, { EngineType.OpenDream, serviceProvider.GetRequiredService() }, - }); + } + .ToFrozenDictionary()); services.AddSingleton(); if (postSetupServices.InternalConfiguration.UsingSystemD)