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; namespace EnvelopeGenerator.Application { public static class DIExtensions { public static IServiceCollection AddEnvelopeGenerator(this IServiceCollection services, IConfigurationSection dispatcherConfigSection, IConfigurationSection mailConfigSection) { //Inject CRUD Service and repositoriesad services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); //Auto mapping profiles services.AddAutoMapper(typeof(BasicDtoMappingProfile).Assembly); services.AddAutoMapper(typeof(UserMappingProfile).Assembly); services.Configure(dispatcherConfigSection); services.Configure(mailConfigSection); //services.Configure(mailConfig.GetSection(typeof(MailConfig).ToString())); //IConfigurationSection section = builder.Configuration.GetSection(typeof(T).Name); return services; } public static IServiceCollection AddEnvelopeGenerator(this IServiceCollection services, IConfiguration config) => services.AddEnvelopeGenerator( dispatcherConfigSection: config.GetSection(typeof(DispatcherConfig).ToString()), mailConfigSection: config.GetSection(typeof(MailConfig).ToString())); } }