namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.Sql.Common; /// Helpers for turning stored event rows into HistoricalEvents. public static class HistoricalEventRows { /// Clamps a stored severity into the range the event carries. /// Stored severity. /// The severity clamped to 0..65535. public static ushort ClampSeverity(int severity) => (ushort)Math.Clamp(severity, 0, ushort.MaxValue); /// A stored optional text column as the event carries it: empty (the writers' "none") is null. /// The stored text. /// The text, or null when empty or absent. public static string? NullIfEmpty(string? value) => string.IsNullOrEmpty(value) ? null : value; }