using ZB.MOM.WW.Configuration; namespace ZB.MOM.WW.ScadaBridge.NotificationService; /// /// Validates at startup. The values are the SMTP fallback used /// by the central Email delivery adapter when the deployed SmtpConfiguration leaves the /// corresponding field unset: becomes an /// SMTP connect timeout and caps the /// connection pool — a non-positive value there is not a usable fallback. Registered with /// ValidateOnStart() so a bad ScadaBridge:Notification section fails fast at boot with /// a clear, key-naming message. /// public sealed class NotificationOptionsValidator : OptionsValidatorBase { /// protected override void Validate(ValidationBuilder builder, NotificationOptions options) { builder.RequireThat(options.ConnectionTimeoutSeconds > 0, $"ScadaBridge:Notification:ConnectionTimeoutSeconds must be greater than zero " + $"(was {options.ConnectionTimeoutSeconds}); it is the SMTP connect-timeout fallback."); builder.RequireThat(options.MaxConcurrentConnections > 0, $"ScadaBridge:Notification:MaxConcurrentConnections must be greater than zero " + $"(was {options.MaxConcurrentConnections}); it caps the SMTP connection pool."); } }