refactor: rename ScadaLink → ZB.MOM.WW.ScadaBridge (code + projects + namespaces)
Solution + 23 src projects + 26 test projects renamed; folders, csproj, namespaces, and ScadaLinkDbContext/ScadaBridgeDbContext class updated. ActorSystem "scadalink" → "scadabridge", Akka seed-node URLs migrated. SQL roles/logins, LDAP domains, CLI command name, and CLI config dir (~/.scadalink → ~/.scadabridge) also renamed. Build green; 5 Host.Tests fail awaiting SQL login rename in next commit. Pre-existing StaleTagMonitor timing flakes unchanged. Rename script committed at tools/rename-to-scadabridge.sh.
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using ZB.MOM.WW.ScadaBridge.Communication.Grpc;
|
||||
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Repositories;
|
||||
using ZB.MOM.WW.ScadaBridge.SiteRuntime.Persistence;
|
||||
using ZB.MOM.WW.ScadaBridge.SiteRuntime.Repositories;
|
||||
using ZB.MOM.WW.ScadaBridge.SiteRuntime.Scripts;
|
||||
using ZB.MOM.WW.ScadaBridge.SiteRuntime.Streaming;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.SiteRuntime;
|
||||
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Registers Site Runtime services including SiteStorageService for SQLite persistence.
|
||||
/// The caller must register an <see cref="ISiteStorageConnectionProvider"/> or call the
|
||||
/// overload with an explicit connection string.
|
||||
/// </summary>
|
||||
/// <param name="services">The DI service collection to register services into.</param>
|
||||
public static IServiceCollection AddSiteRuntime(this IServiceCollection services)
|
||||
{
|
||||
// SiteStorageService is registered by the Host using AddSiteRuntime(connectionString)
|
||||
// This overload is for backward compatibility / skeleton placeholder
|
||||
return services;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers Site Runtime services with an explicit SQLite connection string.
|
||||
/// </summary>
|
||||
/// <param name="services">The DI service collection to register services into.</param>
|
||||
/// <param name="siteDbConnectionString">The SQLite connection string for the site local storage database.</param>
|
||||
public static IServiceCollection AddSiteRuntime(this IServiceCollection services, string siteDbConnectionString)
|
||||
{
|
||||
services.AddSingleton(sp =>
|
||||
{
|
||||
var logger = sp.GetRequiredService<ILogger<SiteStorageService>>();
|
||||
return new SiteStorageService(siteDbConnectionString, logger);
|
||||
});
|
||||
|
||||
services.AddHostedService<SiteStorageInitializer>();
|
||||
|
||||
// WP-19: Script compilation service
|
||||
services.AddSingleton<ScriptCompilationService>();
|
||||
|
||||
// WP-17: Shared script library
|
||||
services.AddSingleton<SharedScriptLibrary>();
|
||||
|
||||
// WP-23: Site stream manager — registered as singleton and exposed as ISiteStreamSubscriber
|
||||
// so the gRPC server can subscribe relay actors to instance events.
|
||||
// ActorSystem is injected later via Initialize() after AkkaHostedService starts.
|
||||
services.AddSingleton(sp =>
|
||||
{
|
||||
var options = sp.GetRequiredService<IOptions<SiteRuntimeOptions>>().Value;
|
||||
var logger = sp.GetRequiredService<ILogger<SiteStreamManager>>();
|
||||
return new SiteStreamManager(options, logger);
|
||||
});
|
||||
services.AddSingleton<ISiteStreamSubscriber>(sp => sp.GetRequiredService<SiteStreamManager>());
|
||||
|
||||
// Site-local repository implementations backed by SQLite
|
||||
services.AddScoped<IExternalSystemRepository, SiteExternalSystemRepository>();
|
||||
services.AddScoped<INotificationRepository, SiteNotificationRepository>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
/// <summary>Registers any additional DI services needed by the Site Runtime Akka actors.</summary>
|
||||
/// <param name="services">The DI service collection to register services into.</param>
|
||||
public static IServiceCollection AddSiteRuntimeActors(this IServiceCollection services)
|
||||
{
|
||||
// Actor registration is handled by AkkaHostedService.RegisterSiteActors()
|
||||
// which creates the DeploymentManager singleton and proxy
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user