using DigitalData.UserManager.Application.Contracts; using DigitalData.UserManager.Application.MappingProfiles; using DigitalData.UserManager.Application.Services; using DigitalData.UserManager.Infrastructure.Contracts; using DigitalData.UserManager.Infrastructure.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; namespace DigitalData.UserManager.Application { public static class DIExtensions { /// /// Extension method to configure dependency injection for the UserManager application. /// /// /// This method registers AutoMapper profiles, repositories, and services for the UserManager application. /// /// The IServiceCollection to add services to. /// The updated IServiceCollection. public static IServiceCollection AddUserManager(this IServiceCollection services, Action? optionsAction) => services .AddDbContext(optionsAction: optionsAction) .AddAutoMapper(typeof(UserMappingProfile).Assembly) .AddAutoMapper(typeof(GroupMappingProfile).Assembly) .AddAutoMapper(typeof(GroupOfUserMappingProfile).Assembly) .AddAutoMapper(typeof(ModuleMappingProfile).Assembly) .AddAutoMapper(typeof(ModuleOfUserMappingProfile).Assembly) .AddAutoMapper(typeof(UserRepMappingProfile).Assembly) .AddScoped() .AddScoped() .AddScoped() .AddScoped() .AddScoped() .AddScoped() .AddScoped() .AddScoped() .AddScoped() .AddScoped() .AddScoped() .AddScoped(); } }