Skip to content
This repository was archived by the owner on Feb 2, 2026. It is now read-only.
This repository was archived by the owner on Feb 2, 2026. It is now read-only.

Very complex configuration #430

Description

@fatalistt

In Startup.ConfigureServices of Admin and AdminApi projects there are lots of Type parameters (Admin, for example).
It's very difficult to understand, which parameter user should to change if he want to change something.
I suppose to create a builder to split this method. It'll look something like this:

services.AddAdminAspNetIdentityServices(); // With default values like string keys, DbContexts, etc.
services.AddAdminAspNetIdentityServices(admin => {
    admin.ConfigureIdentity(identity => {
        identity.ConfigureKeys(keys => {
            keys.UseUserKey<string>();
            ...
        })
        .ConfigureEntities(entities => {
            entities.UseUser<IdentityUser<string>>();
            ...
        });
    }
    ...
});

In configuration we start from default values, so user can skip some blocks like ConfigureKeys.
I start to making this, but I have some question for now (may be I'll add some more later):
In Skoruba.IdentityServer4.Admin.EntityFramework.Identity.Repositories.IdentityRepository you have TUserKey, TRoleKey, and TKey parameters (src).
TUserKey and TRoleKey are never used except these 2 methods: ConvertUserKeyFromString and ConvertRoleKeyFromString
All other parameters are depend from TKey (TUser : IdentityUser<TKey>, for example).
Later you use UserManager<IdentityUser<TKey>>.Users.AnyAsync(x => x.Id.Equals(_instance of TUserKey_)); here.
If TKey and TUserKey will be a different types, this code will fall, isn't it?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions