using Mapster; using Microsoft.Extensions.DependencyInjection; using DD.Persistence.Database.Model; using DD.Persistence.Models; using DD.Persistence.Repositories; using DD.Persistence.Repository.Repositories; using DD.Persistence.Database.Entity; using System.Reflection; namespace DD.Persistence.Repository; public static class DependencyInjection { public static void MapsterSetup() { TypeAdapterConfig.GlobalSettings.Default.Config .ForType() .Ignore(dest => dest.System, dest => dest.SystemId); TypeAdapterConfig.NewConfig() .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) { var typeAdapterConfig = TypeAdapterConfig.GlobalSettings; typeAdapterConfig.RuleMap.Clear(); typeAdapterConfig.Scan(Assembly.GetExecutingAssembly()); MapsterSetup(); services.AddTransient, TimeSeriesDataRepository>(); services.AddTransient(); services.AddTransient, TimeSeriesDataCachedRepository>(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); return services; } }