Tôi đang cố gắng sử dụng gói Nhận dạng của .NET Core với nhiều lớp mở rộng IdentityUser<Guid>nhưng với một UserRolelớp duy nhất .
Tôi có nhiều lớp mở rộng UserStore<T>cho từng loại người dùng và một lớp duy nhất mở rộng RoleStore<UserRole>.
Sau đây là của tôi startup.cs:
services.AddIdentity<InternalUser, UserRole>(IdentityOptions)
    .AddDefaultTokenProviders()
    .AddUserStore<InternalUserStore>()
    .AddRoleStore<GenericUserRoleStore>();
services.AddIdentityCore<Contractor>(IdentityOptions)
    .AddRoles<UserRole>()
    .AddDefaultTokenProviders()
    .AddUserStore<ContractorUserStore>()
    .AddRoleStore<GenericUserRoleStore>();
services.AddIdentityCore<Homeowner>(IdentityOptions)
    .AddRoles<UserRole>()
    .AddDefaultTokenProviders()
    .AddUserStore<HomeownerUserStore>()
    .AddRoleStore<GenericUserRoleStore>();Của tôi DbContextkhông mở rộng IdentityDbContext:
public sealed class EntityDbContext: DbContext { }Tôi đã nhận được nhiều lỗi vì vậy tôi đã thêm vào sau đây DbContextnhưng tôi đã nhận xét nó:
public DbSet<IdentityUserClaim<Guid>> UserClaims { get; set; }
public DbSet<IdentityUserRole<Guid>> UserRoles { get; set; }Tôi đang nhận được nhiều lỗi khác nhau:
xây dựng Lỗi trên Instance 'Dal.IdentityStores.I InternalalUserStore' cho PluginType IUserStore - và Instance 'RoleManager' cho PluginType Microsoft.AspNetCore.Identity.RoleManager
1[Models.Entities.Users.UserRole] - and Instance 'Dal.IdentityStores.GenericUserRoleStore' for PluginType Microsoft.AspNetCore.Identity.IRoleStore1 [Model.Entities.Users.User. PluginType Microsoft.AspNetCore.Identity.IRoleStore1[Models.Entities.Users.UserRole] - and Instance 'Dal.IdentityStores.ContractorUserStore' for PluginType Microsoft.AspNetCore.Identity.IUserStore1 [Models.Entities.Contractors.Contractor] - và Instance 'UserClaimsPrincipalFactory' cho PluginType Microsoft.AspNetCore.Identity.IUserClaimsPrincipalFactory1[Models.Entities.Contractors.Contractor] - and Instance 'UserClaimsPrincipalFactory<Contractor, UserRole>' for PluginType Microsoft.AspNetCore.Identity.IUserClaimsPrincipalFactory1 [Models.Entities.Contractors.Contractor] - và Instance 'UserManager' cho PluginType Microsoft.AspNetCore.Identity.UserManager1[Models.Entities.Homeowners.Homeowner] - and Instance 'UserClaimsPrincipalFactory<Homeowner>' for PluginType Microsoft.AspNetCore.Identity.IUserClaimsPrincipalFactory1 [Model.Entities.Homeowners.Homeowner]
Đây là liên kết đến repo của tôi