40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
using Mapster;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Persistence.Database.Model;
|
|
using Persistence.Models;
|
|
using Persistence.Repositories;
|
|
using Persistence.Repository.Data;
|
|
using Persistence.Repository.Repositories;
|
|
|
|
namespace Persistence.Repository;
|
|
public static class DependencyInjection
|
|
{
|
|
public static void MapsterSetup()
|
|
{
|
|
TypeAdapterConfig.GlobalSettings.Default.Config
|
|
.ForType<ChangeLog, ChangeLogDto>()
|
|
.Map(dest => dest.Value, src => new DataWithWellDepthAndSectionDto()
|
|
{
|
|
DepthEnd = src.DepthEnd,
|
|
DepthStart = src.DepthStart,
|
|
IdSection = src.IdSection,
|
|
Value = src.Value,
|
|
Id = src.Id
|
|
});
|
|
|
|
}
|
|
|
|
public static IServiceCollection AddInfrastructure(this IServiceCollection services)
|
|
{
|
|
MapsterSetup();
|
|
|
|
services.AddTransient<ITimeSeriesDataRepository<DataSaubDto>, TimeSeriesDataRepository<DataSaub, DataSaubDto>>();
|
|
services.AddTransient<ISetpointRepository, SetpointRepository>();
|
|
services.AddTransient<ITimeSeriesDataRepository<DataSaubDto>, TimeSeriesDataCachedRepository<DataSaub, DataSaubDto>>();
|
|
services.AddTransient<IChangeLogRepository, ChangeLogRepository>();
|
|
services.AddTransient<ITimestampedSetRepository, TimestampedSetRepository>();
|
|
|
|
return services;
|
|
}
|
|
}
|