Merge branch 'worktree-agent-a0098b40576d74cfd' into arch-review-remediation

This commit is contained in:
Joseph Doherty
2026-08-14 21:15:32 -04:00
59 changed files with 3051 additions and 231 deletions
@@ -1,10 +1,12 @@
using Microsoft.AspNetCore.DataProtection;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces;
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Repositories;
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Transport;
using ZB.MOM.WW.ScadaBridge.Commons.Types.Templates;
using ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Maintenance;
using ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Repositories;
using ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Services;
@@ -65,6 +67,13 @@ public static class ServiceCollectionExtensions
return new ScadaBridgeDbContext(options, protectionProvider);
});
// Process-wide template/instance version watermark. Singleton because the
// writer (TemplateEngineRepository.SaveChangesAsync, scoped) and the readers
// (the flatten-session cache and the staleness fast path, also scoped) must
// observe the same counters across DI scopes. TryAdd so the DeploymentManager
// registration of the same interface is idempotent.
services.TryAddSingleton<ITemplateGraphWatermark, TemplateGraphWatermark>();
services.AddScoped<ISecurityRepository, SecurityRepository>();
services.AddScoped<ICentralUiRepository, CentralUiRepository>();
services.AddScoped<ITemplateEngineRepository, TemplateEngineRepository>();