Füge DI-Erweiterungsmethode hinzu, um AutoMapper-Profile, Repositorys und Services für die UserManager-Anwendung zu konfigurieren.
This commit is contained in:
42
DigitalData.UserManager.Application/DIExtensions.cs
Normal file
42
DigitalData.UserManager.Application/DIExtensions.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
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>();
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,9 @@
|
||||
<Reference Include="DigitalData.Core.DTO">
|
||||
<HintPath>..\..\WebCoreModules\DigitalData.Core.Application\bin\Debug\net7.0\DigitalData.Core.DTO.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Core.Infrastructure">
|
||||
<HintPath>..\..\WebCoreModules\DigitalData.Core.Infrastructure\bin\Debug\net7.0\DigitalData.Core.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.EmailProfilerDispatcher.Domain">
|
||||
<HintPath>..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Domain\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Domain.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
Reference in New Issue
Block a user