question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Very complex configuration

See original GitHub issue

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?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
fatalisttcommented, Dec 4, 2019

Yes, of course. IdentityUserRole<TKey> from AspNetCore. Constraint for TUserRole in your code.

0reactions
skorubacommented, Feb 16, 2020

Hi @b0 I definitely agree with you, I am happy for this PR, but it is too complex - splitting would be perfect.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to deal with configuration files that are becoming too ...
1) these queries have become so complex that they are now a language of their own and only the developer can be confident...
Read more >
Complex Configuration for High Tech
A product configurator automates the configuration and customization of the most complex equipment and machinery. Sales reps can quickly and easily narrow down ......
Read more >
The 3 Best Config File Formats - Jonathan Hall
There are countless configuration file formats. Some are custom-designed for a specific application, such as those used by the Apache web ...
Read more >
Need help with very complex scheduling - Configuration
I would like to start the poolpump for an hour with start at 9am if we are exporting more than 1700Watt (ie if...
Read more >
Which comparator is generally used to measure small ...
Explanation: This is generally used to measure the small displacement of spindles. It is having a sensitive gauging head with a high-quality ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found