namespace ZB.MOM.WW.ScadaBridge.ManagementService; /// /// Preserve-if-null merge rules for the partial update commands (CLI-2): /// UpdateSiteCommand, UpdateDataConnectionCommand and /// UpdateApiMethodCommand. A null field means "not supplied — keep the /// stored value"; an empty (or whitespace-only) string means "clear this optional /// field". The CLI sends only the options that were actually passed, and the Central /// UI's full-entity forms send an empty string for a field the operator cleared. /// internal static class PartialUpdate { /// Merges an optional (nullable) string field. /// The value carried by the command, or null when not supplied. /// The value currently stored. /// when is null; null when it is blank; otherwise . public static string? Optional(string? incoming, string? stored) => incoming is null ? stored : string.IsNullOrWhiteSpace(incoming) ? null : incoming; }