2024-12-26 13:42:14 +05:00
|
|
|
|
using DD.Persistence.Client.Clients;
|
|
|
|
|
using DD.Persistence.Client.Clients.Interfaces;
|
2025-02-12 15:14:14 +05:00
|
|
|
|
using DD.Persistence.Client.Clients.Mapping;
|
2024-12-27 13:35:18 +05:00
|
|
|
|
using DD.Persistence.Models;
|
2024-12-26 13:42:14 +05:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
namespace DD.Persistence.Client;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class DependencyInjection
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="services"></param>
|
|
|
|
|
/// <returns></returns>
|
2025-01-17 16:39:36 +05:00
|
|
|
|
public static IServiceCollection AddPersistenceClients(this IServiceCollection services, Dictionary<Guid, Type>? setpointTypeConfigs = null)
|
2024-12-26 13:42:14 +05:00
|
|
|
|
{
|
2024-12-27 13:35:18 +05:00
|
|
|
|
services.AddTransient(typeof(IRefitClientFactory<>), typeof(RefitClientFactory<>));
|
2024-12-26 13:42:14 +05:00
|
|
|
|
services.AddTransient<IChangeLogClient, ChangeLogClient>();
|
2024-12-27 00:37:52 +05:00
|
|
|
|
services.AddTransient<IDataSourceSystemClient, DataSourceSystemClient>();
|
|
|
|
|
services.AddTransient<ISetpointClient, SetpointClient>();
|
2024-12-27 13:35:18 +05:00
|
|
|
|
services.AddTransient<ITechMessagesClient, TechMessagesClient>();
|
2025-01-15 17:37:48 +05:00
|
|
|
|
services.AddTransient<ITimestampedValuesClient, TimestampedValuesClient>();
|
2024-12-27 13:35:18 +05:00
|
|
|
|
services.AddTransient<IWitsDataClient, WitsDataClient>();
|
2025-01-17 16:39:36 +05:00
|
|
|
|
|
2025-02-12 15:14:14 +05:00
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static IServiceCollection AddPersistenceMapping(this IServiceCollection services, Dictionary<Guid, Type>? mappingConfigs)
|
|
|
|
|
{
|
|
|
|
|
services.AddTransient<ISetpointMappingClient, SetpointMappingClient>(provider =>
|
2025-01-17 16:39:36 +05:00
|
|
|
|
{
|
2025-02-12 15:14:14 +05:00
|
|
|
|
var client = provider.GetRequiredService<ISetpointClient>();
|
|
|
|
|
return new SetpointMappingClient(client, mappingConfigs);
|
2025-01-17 16:39:36 +05:00
|
|
|
|
});
|
2025-02-12 15:14:14 +05:00
|
|
|
|
services.AddTransient<ITimestampedMappingClient, TimestampedMappingClient>();
|
2024-12-26 13:42:14 +05:00
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
}
|