using Microsoft.Extensions.DependencyInjection;
using ZB.MOM.WW.ScadaBridge.Communication.Grpc;
namespace ZB.MOM.WW.ScadaBridge.Communication;
public static class ServiceCollectionExtensions
{
/// Registers communication services including options, , gRPC client factory, and debug stream.
/// The DI service collection to register services into.
/// The same to allow chaining.
public static IServiceCollection AddCommunication(this IServiceCollection services)
{
services.AddOptions()
.BindConfiguration("Communication");
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
return services;
}
/// Hook for registering additional DI services needed by communication actors; actor creation itself happens inside AkkaHostedService.
/// The DI service collection to register services into.
/// The same to allow chaining.
public static IServiceCollection AddCommunicationActors(this IServiceCollection services)
{
// Actor registration happens in AkkaHostedService.RegisterCentralActors/RegisterSiteActors.
// This method is a hook for any additional DI registrations needed by the communication actors.
return services;
}
}