using Microsoft.Extensions.Options; using ZB.MOM.WW.ScadaBridge.StoreAndForward; namespace ZB.MOM.WW.ScadaBridge.Host; /// /// Host-side adapter implementing the /// optional the Store-and-Forward /// service consults to stamp cached-call audit telemetry with the site id. /// /// /// Forwards verbatim — the same value /// exposes to HealthMonitoring. Defined as /// a separate adapter (rather than reusing ) /// to avoid pulling HealthMonitoring into the StoreAndForward project's /// dependency graph, which would create a project-reference cycle. /// public class StoreAndForwardSiteContext : IStoreAndForwardSiteContext { /// public string SiteId { get; } /// Initializes a new instance of . /// Node options supplying the site identifier. public StoreAndForwardSiteContext(IOptions nodeOptions) { // NodeOptions.SiteId is nullable; SiteServiceRegistration ONLY adds // this binding on the site role, so a non-null site id is expected // here. Mirror SiteIdentityProvider's hard fail so a missing site id // surfaces at composition time rather than at the first cached call. SiteId = nodeOptions.Value.SiteId ?? throw new InvalidOperationException( "ScadaBridge:Node:SiteId is required for the site role's StoreAndForward wiring."); } }