fix(EnvelopeMailService): Vermeiden Sie gemeinsam genutzte veränderbare Zustände in EnvelopeMailService-Platzhaltern

EnvelopeMailService wurde umgestaltet, um gemeinsam genutzte Veränderungen des _placeholders-Wörterbuchs zu vermeiden.
Die Konfigurationseigenschaft MailParams.Placeholders wurde von einem veränderbaren Dictionary<string, string>
zu einem ImmutableDictionary<string, string> geändert, und _placeholders wird nun bei der Dienstkonstruktion als neues Wörterbuch instanziiert.
This commit is contained in:
tekh 2025-08-07 17:01:32 +02:00
parent 286e17a900
commit c7d26a87b0
2 changed files with 9 additions and 7 deletions

View File

@ -1,4 +1,6 @@
namespace EnvelopeGenerator.Application.Configurations;
using System.Collections.Immutable;
namespace EnvelopeGenerator.Application.Configurations;
/// <summary>
///
@ -8,5 +10,5 @@ public class MailParams
/// <summary>
///
/// </summary>
public required Dictionary<string, string> Placeholders { get; init; }
public required ImmutableDictionary<string, string> Placeholders { get; init; }
}

View File

@ -44,11 +44,11 @@ private readonly IAuthenticator _authenticator;
public EnvelopeMailService(IEmailOutRepository repository, IMapper mapper, IEmailTemplateService tempService, IEnvelopeReceiverService envelopeReceiverService, IOptions<DispatcherParams> dispatcherConfigOptions, IConfigService configService, IOptions<MailParams> mailConfig, IAuthenticator authenticator) : base(repository, mapper)
{
_tempService = tempService;
_envRcvService = envelopeReceiverService;
_dConfig = dispatcherConfigOptions.Value;
_configService = configService;
_placeholders = mailConfig.Value.Placeholders;
_authenticator = authenticator;
_envRcvService = envelopeReceiverService;
_dConfig = dispatcherConfigOptions.Value;
_configService = configService;
_placeholders = new Dictionary<string, string>(mailConfig.Value.Placeholders);
_authenticator = authenticator;
}
private async Task<Dictionary<string, string>> CreatePlaceholders(string? accessCode = null, EnvelopeReceiverDto? envelopeReceiverDto = null)