From c5bf11270fb038bb7f6ee16ae9aeb10c26285260 Mon Sep 17 00:00:00 2001 From: Maksym Sadovnychyy Date: Sun, 15 Dec 2024 13:04:06 +0100 Subject: [PATCH] (bugfix): TryGetOperation case insensitive dictionary keys --- .../Abstractions/Webapi/PatchRequestModelBase.cs | 7 +++---- src/MaksIT.Core/MaksIT.Core.csproj | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/MaksIT.Core/Abstractions/Webapi/PatchRequestModelBase.cs b/src/MaksIT.Core/Abstractions/Webapi/PatchRequestModelBase.cs index 19be0f1..b221924 100644 --- a/src/MaksIT.Core/Abstractions/Webapi/PatchRequestModelBase.cs +++ b/src/MaksIT.Core/Abstractions/Webapi/PatchRequestModelBase.cs @@ -23,15 +23,14 @@ public abstract class PatchRequestModelBase : RequestModelBase { /// When this method returns, contains the patch operation associated with the specified property name, if the key is found; otherwise, null. /// true if the patch operation is found; otherwise, false. public bool TryGetOperation(string propertyName, [NotNullWhen(true)] out PatchOperation? operation) { - propertyName = propertyName.ToLower(); - if (Operations == null) { operation = null; return false; } - if (Operations.TryGetValue(propertyName, out var tempOperation)) { - operation = tempOperation; + var entry = Operations.FirstOrDefault(op => op.Key.Equals(propertyName, StringComparison.OrdinalIgnoreCase)); + if (!entry.Equals(default(KeyValuePair))) { + operation = entry.Value; return true; } else { diff --git a/src/MaksIT.Core/MaksIT.Core.csproj b/src/MaksIT.Core/MaksIT.Core.csproj index 7b96e24..7824c4e 100644 --- a/src/MaksIT.Core/MaksIT.Core.csproj +++ b/src/MaksIT.Core/MaksIT.Core.csproj @@ -8,7 +8,7 @@ MaksIT.Core - 1.2.7 + 1.2.8 Maksym Sadovnychyy MAKS-IT MaksIT.Core