Files
ScadaBridge/src/ZB.MOM.WW.ScadaBridge.DataConnectionLayer/ServiceCollectionExtensions.cs
T
Joseph Doherty 5461e4968e feat(dcl): register MxGateway protocol in factory + config flatten + options
DataConnectionFactory registers 'MxGateway' -> MxGatewayDataConnection over the
real client; AddDataConnectionLayer binds MxGatewayGlobalOptions; DeploymentManager
FlattenConnectionConfig gains an MxGateway arm using the typed serializer. Factory
test confirms Create("MxGateway") returns the adapter.
2026-05-29 07:58:51 -04:00

40 lines
1.7 KiB
C#

using Microsoft.Extensions.DependencyInjection;
namespace ZB.MOM.WW.ScadaBridge.DataConnectionLayer;
/// <summary>
/// DI registration extensions for the Data Connection Layer.
/// </summary>
public static class ServiceCollectionExtensions
{
/// <summary>Registers Data Connection Layer options and core services.</summary>
/// <param name="services">The DI service collection to register into.</param>
/// <returns>The same <paramref name="services"/> instance for chaining.</returns>
public static IServiceCollection AddDataConnectionLayer(this IServiceCollection services)
{
services.AddOptions<DataConnectionOptions>()
.BindConfiguration("DataConnectionLayer");
services.AddOptions<OpcUaGlobalOptions>()
.BindConfiguration("OpcUa");
services.AddOptions<MxGatewayGlobalOptions>()
.BindConfiguration("MxGateway");
// WP-34: Register the factory for protocol extensibility
services.AddSingleton<IDataConnectionFactory, DataConnectionFactory>();
return services;
}
/// <summary>Placeholder for actor registration; Data Connection Layer actors are created inside the ActorSystem.</summary>
/// <param name="services">The DI service collection.</param>
/// <returns>The same <paramref name="services"/> instance for chaining.</returns>
public static IServiceCollection AddDataConnectionLayerActors(this IServiceCollection services)
{
// Actor registration happens in AkkaHostedService or SiteCommunicationActor setup.
// DataConnectionManagerActor and DataConnectionActor instances are created by the actor system.
return services;
}
}