(bugfix): TryGetOperation case insensitive dictionary keys

This commit is contained in:
Maksym Sadovnychyy 2024-12-15 13:04:06 +01:00
parent 7cddda23e6
commit c5bf11270f
2 changed files with 4 additions and 5 deletions

View File

@ -23,15 +23,14 @@ public abstract class PatchRequestModelBase : RequestModelBase {
/// <param name="operation">When this method returns, contains the patch operation associated with the specified property name, if the key is found; otherwise, null.</param>
/// <returns>true if the patch operation is found; otherwise, false.</returns>
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<string, PatchOperation>))) {
operation = entry.Value;
return true;
}
else {

View File

@ -8,7 +8,7 @@
<!-- NuGet package metadata -->
<PackageId>MaksIT.Core</PackageId>
<Version>1.2.7</Version>
<Version>1.2.8</Version>
<Authors>Maksym Sadovnychyy</Authors>
<Company>MAKS-IT</Company>
<Product>MaksIT.Core</Product>