(feature): TryGetOperation property name case insensitive

This commit is contained in:
Maksym Sadovnychyy 2024-12-15 01:12:46 +01:00
parent d7b0145f08
commit 7cddda23e6
2 changed files with 9 additions and 1 deletions

View File

@ -16,7 +16,15 @@ public abstract class PatchRequestModelBase : RequestModelBase {
.Where(prop => prop.Name != nameof(Operations)) .Where(prop => prop.Name != nameof(Operations))
.Any(prop => prop.GetValue(this) != null); .Any(prop => prop.GetValue(this) != null);
/// <summary>
/// Attempts to retrieve the patch operation associated with the specified property name (case insensitive).
/// </summary>
/// <param name="propertyName">The name of the property for which to retrieve the patch operation.</param>
/// <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) { public bool TryGetOperation(string propertyName, [NotNullWhen(true)] out PatchOperation? operation) {
propertyName = propertyName.ToLower();
if (Operations == null) { if (Operations == null) {
operation = null; operation = null;
return false; return false;

View File

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