Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending UserRole-Class causes Exception #37

Open
Martin-Stein opened this issue Dec 2, 2020 · 0 comments
Open

Extending UserRole-Class causes Exception #37

Martin-Stein opened this issue Dec 2, 2020 · 0 comments

Comments

@Martin-Stein
Copy link

Hi There,

I am trying to extend the Identity framework. Extending IdenityUser works fine, but when I try to entend the IdenityUserRole class, I run into an System.Argument Exception "GenericArguments[5], 'SecondHandWeb.Areas.Identity.Data.SecondHandWebUserRole', on 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore`9[TUser,TRole,TContext,TKey,TUserClaim,TUserRole,TUserLogin,TUserToken,TRoleClaim]' violates the constraint of type 'TUserRole'." in IdentityHostingStartup.cs

            services.AddIdentity<SecondHandWebUser, SecondHandWebRole>( )
                .AddEntityFrameworkStores<SecondHandWebContext>()
                .AddDefaultTokenProviders()
                .AddDefaultUI(); 

the constructor for my Context looks like this:

    public class SecondHandWebContext : IdentityDbContext<SecondHandWebUser, IdentityRole<string>, string, IdentityUserClaim<string>, SecondHandWebUserRole, IdentityUserLogin<string>, IdentityRoleClaim<string>, IdentityUserToken<string>>

I am using the latest Nugetpackage, Microsoft.AspNetCore.Identity.EntityFrameworkCore 5.0

who can I solve this??

Kind regards,

Martin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant