43 lines
2.1 KiB
C#
43 lines
2.1 KiB
C#
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.Extensions.DependencyInjection;
|
|
|
|
namespace DigitalData.UserManager.Application
|
|
{
|
|
public static class DIExtensions
|
|
{
|
|
/// <summary>
|
|
/// Extension method to configure dependency injection for the UserManager application.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// This method registers AutoMapper profiles, repositories, and services for the UserManager application.
|
|
/// </remarks>
|
|
/// <param name="services">The IServiceCollection to add services to.</param>
|
|
/// <returns>The updated IServiceCollection.</returns>
|
|
public static IServiceCollection AddUserManager(this IServiceCollection services) => services
|
|
.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<IUserRepository, UserRepository>()
|
|
.AddScoped<IGroupRepository, GroupRepository>()
|
|
.AddScoped<IGroupOfUserRepository, GroupOfUserRepository>()
|
|
.AddScoped<IModuleRepository, ModuleRepository>()
|
|
.AddScoped<IModuleOfUserRepository, ModuleOfUserRepository>()
|
|
.AddScoped<IUserRepRepository, UserRepRepository>()
|
|
|
|
.AddScoped<IUserService, UserService>()
|
|
.AddScoped<IGroupService, GroupService>()
|
|
.AddScoped<IGroupOfUserService, GroupOfUserService>()
|
|
.AddScoped<IModuleService, ModuleService>()
|
|
.AddScoped<IModuleOfUserService, ModuleOfUserService>()
|
|
.AddScoped<IUserRepService, UserRepService>();
|
|
}
|
|
}
|