persistence/DD.Persistence.Client/DependencyInjection.cs
Roman Efremov 0c1210fbcc
All checks were successful
Unit tests / test (push) Successful in 2m44s
Merge branch 'master' into TimestampedValuesRepository
2025-01-20 17:24:01 +05:00

35 lines
1.3 KiB
C#

using DD.Persistence.Client.Clients;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Models;
using Microsoft.Extensions.DependencyInjection;
namespace DD.Persistence.Client;
/// <summary>
///
/// </summary>
public static class DependencyInjection
{
/// <summary>
///
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
public static IServiceCollection AddPersistenceClients(this IServiceCollection services, Dictionary<Guid, Type>? setpointTypeConfigs = null)
{
services.AddTransient(typeof(IRefitClientFactory<>), typeof(RefitClientFactory<>));
services.AddTransient<IChangeLogClient, ChangeLogClient>();
services.AddTransient<IDataSourceSystemClient, DataSourceSystemClient>();
services.AddTransient<ISetpointClient, SetpointClient>();
services.AddTransient<ITechMessagesClient, TechMessagesClient>();
services.AddTransient<ITimestampedValuesClient, TimestampedValuesClient>();
services.AddTransient<IWitsDataClient, WitsDataClient>();
services.AddSingleton<ISetpointConfigStorage, SetpointConfigStorage>(provider =>
{
return new SetpointConfigStorage(setpointTypeConfigs);
});
return services;
}
}