AspNetIdentity
AspNetIdentity copied to clipboard
Extending UserRole-Class causes Exception
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