Refactor DIExtensions.AddUserManager to Use Generic TDbContext for Improved Flexibility.

This commit is contained in:
Developer 02
2024-06-13 13:44:51 +02:00
parent 8faed31baa
commit 43c98f9454
9 changed files with 39 additions and 30 deletions

View File

@@ -38,6 +38,10 @@ try {
options.LogoutPath = "/api/auth/logout";
});
builder.Services.AddDbContext<UserManagerDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("DD_ECM_Connection"))
.EnableDetailedErrors());
var allowedOrigins = builder.Configuration.GetSection("AllowedOrigins").Get<string[]>() ?? throw new InvalidOperationException("In appsettings there is no allowed origin.");
builder.Services.AddCors(options =>
@@ -53,9 +57,7 @@ try {
});
//builder.Services.AddAutoMapper(typeof(DirectoryMappingProfile).Assembly);
builder.Services.AddUserManager(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("DD_ECM_Connection"))
.EnableDetailedErrors());
builder.Services.AddUserManager<UserManagerDbContext>();
builder.Services.AddDirectorySearchService();