Füge DI-Erweiterungsmethode hinzu, um AutoMapper-Profile, Repositorys und Services für die UserManager-Anwendung zu konfigurieren.
This commit is contained in:
parent
42deb8a2f5
commit
d2dc116cd0
@ -1,9 +1,6 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using DigitalData.UserManager.Application.MappingProfiles;
|
|
||||||
using DigitalData.UserManager.Application.Contracts;
|
|
||||||
using DigitalData.UserManager.Application.Services;
|
|
||||||
using DigitalData.UserManager.Infrastructure.Repositories;
|
using DigitalData.UserManager.Infrastructure.Repositories;
|
||||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
using DigitalData.UserManager.Application;
|
||||||
using DigitalData.Core.Application;
|
using DigitalData.Core.Application;
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
using NLog.Web;
|
using NLog.Web;
|
||||||
@ -59,27 +56,8 @@ try {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.Services.AddAutoMapper(typeof(UserMappingProfile).Assembly);
|
|
||||||
builder.Services.AddAutoMapper(typeof(GroupMappingProfile).Assembly);
|
|
||||||
builder.Services.AddAutoMapper(typeof(GroupOfUserMappingProfile).Assembly);
|
|
||||||
builder.Services.AddAutoMapper(typeof(ModuleMappingProfile).Assembly);
|
|
||||||
builder.Services.AddAutoMapper(typeof(ModuleOfUserMappingProfile).Assembly);
|
|
||||||
builder.Services.AddAutoMapper(typeof(UserRepMappingProfile).Assembly);
|
|
||||||
//builder.Services.AddAutoMapper(typeof(DirectoryMappingProfile).Assembly);
|
//builder.Services.AddAutoMapper(typeof(DirectoryMappingProfile).Assembly);
|
||||||
|
builder.Services.AddUserManager();
|
||||||
builder.Services.AddScoped<IUserRepository, UserRepository>();
|
|
||||||
builder.Services.AddScoped<IGroupRepository, GroupRepository>();
|
|
||||||
builder.Services.AddScoped<IGroupOfUserRepository, GroupOfUserRepository>();
|
|
||||||
builder.Services.AddScoped<IModuleRepository, ModuleRepository>();
|
|
||||||
builder.Services.AddScoped<IModuleOfUserRepository, ModuleOfUserRepository>();
|
|
||||||
builder.Services.AddScoped<IUserRepRepository, UserRepRepository>();
|
|
||||||
|
|
||||||
builder.Services.AddScoped<IUserService, UserService>();
|
|
||||||
builder.Services.AddScoped<IGroupService, GroupService>();
|
|
||||||
builder.Services.AddScoped<IGroupOfUserService, GroupOfUserService>();
|
|
||||||
builder.Services.AddScoped<IModuleService, ModuleService>();
|
|
||||||
builder.Services.AddScoped<IModuleOfUserService, ModuleOfUserService>();
|
|
||||||
builder.Services.AddScoped<IUserRepService, UserRepService>();
|
|
||||||
|
|
||||||
builder.Services.AddDirectorySearchService();
|
builder.Services.AddDirectorySearchService();
|
||||||
|
|
||||||
|
|||||||
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">
|
<Reference Include="DigitalData.Core.DTO">
|
||||||
<HintPath>..\..\WebCoreModules\DigitalData.Core.Application\bin\Debug\net7.0\DigitalData.Core.DTO.dll</HintPath>
|
<HintPath>..\..\WebCoreModules\DigitalData.Core.Application\bin\Debug\net7.0\DigitalData.Core.DTO.dll</HintPath>
|
||||||
</Reference>
|
</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">
|
<Reference Include="DigitalData.EmailProfilerDispatcher.Domain">
|
||||||
<HintPath>..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Domain\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Domain.dll</HintPath>
|
<HintPath>..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Domain\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Domain.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user