feat(DIExtensions): AddUserManager hinzugefügt, um mit db-Kontext hinzuzufügen

This commit is contained in:
Developer 02
2025-01-15 12:45:59 +01:00
parent fbf9bbeba0
commit 33326866f9
2 changed files with 16 additions and 6 deletions

View File

@@ -44,6 +44,16 @@ namespace DigitalData.UserManager.Application
.AddScoped<IModuleOfUserService, ModuleOfUserService>()
.AddScoped<IUserRepService, UserRepService>();
/// <summary>
/// Adds the UserManager services and repositories to the specified <see cref="IServiceCollection"/>.
/// This method registers the necessary mappings, repositories, services and <see cref="UserManagerDbContext"/> for the UserManager.
/// </summary>
/// <param name="services">The IServiceCollection to which the services will be added.</param>
/// <returns>The updated IServiceCollection.</returns>
public static IServiceCollection AddUserManager(this IServiceCollection services, string connectionString)=> services
.AddDbContext<UserManagerDbContext>(options => options.UseSqlServer(connectionString).EnableSensitiveDataLogging())
.AddUserManager<UserManagerDbContext>();
public static IServiceCollection AddEncryptor(this IServiceCollection services, IConfiguration configuration)
{
services.AddSingleton<Encryptor>();