using DigitalData.UserManager.Application.MappingProfiles; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.MappingProfiles; using EnvelopeGenerator.Application.Configurations; using EnvelopeGenerator.Application.Services; using EnvelopeGenerator.Infrastructure.Contracts; using EnvelopeGenerator.Infrastructure.Repositories; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using DigitalData.Core.Client; using QRCoder; namespace EnvelopeGenerator.Application.Extensions { public static class DIExtensions { public static IServiceCollection AddEnvelopeGenerator(this IServiceCollection services, IConfiguration config) { //Inject CRUD Service and repositoriesad services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); //Auto mapping profiles services.AddAutoMapper(typeof(BasicDtoMappingProfile).Assembly); services.AddAutoMapper(typeof(UserMappingProfile).Assembly); services.ConfigureByTypeName(config); services.ConfigureByTypeName(config); services.ConfigureByTypeName(config); services.ConfigureByTypeName(config); services.AddHttpClientService(config.GetSection(nameof(GtxMessagingParams))); services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton(); return services; } //TODO: move to DigitalData.Core private static IServiceCollection ConfigureByTypeName(this IServiceCollection services, IConfiguration configuration) where TOptions : class => services.Configure(configuration.GetSection(nameof(TOptions))); } }