我正在自定义ASP.NET Core Identity的实体,但我在运行时遇到了这个错误:
Unhandled Exception: System.ArgumentException: GenericArguments[0],
'Kento.Models.ApplicationUser', on 'Microsoft.AspNetCore.Identity
.EntityFrameworkCore.UserStore`4[TUser,TRole,TContext,TKey]' violates
the constraint of type 'TUser'. ---> System.TypeLoadException: Generic
Arguments[0], 'Kento.Models.ApplicationUser', on 'Microsoft.AspNetCore
.Identity.EntityFrameworkCore.UserStore`9[TUser,TRole,TContext,TKey,
TUserClaim,TUserRole,TUserLogin,TUserToken,TRoleClaim]' violates the
constraint of type parameter 'TUser'.
以下是自定义实体列表:
的DbContext:
public class ApplicationDbContext : IdentityDbContext
<ApplicationUser,
ApplicationRole,
string,
ApplicationUserClaim,
ApplicationUserRole,
ApplicationUserLogin,
ApplicationRoleClaim,
ApplicationUserToken>
ApplicationUser:
public class ApplicationUser : IdentityUser
<string, ApplicationUserClaim, ApplicationUserRole, ApplicationUserLogin>
ApplicationRole:
public class ApplicationRole : IdentityRole
<string, ApplicationUserRole, ApplicationRoleClaim>
ApplicationUserClaim:
public class ApplicationUserClaim : IdentityUserClaim<string>
ApplicationUserLogin
public class ApplicationUserLogin : IdentityUserLogin<string>
ApplicationRoleClaim
public class ApplicationRoleClaim : IdentityRoleClaim<string>
ApplicationUserToken
public class ApplicationUserToken : IdentityUserToken<string>
我很困惑这里发生了什么。