无法创建AplicationRoleManager和ApplicationUserManager类(标识)

问题描述 投票:0回答:1

当我在数据访问层中为ApplicationUserManagerApplicationRoleManager类创建构造函数时,出现此错误:


There is no argument given that corresponds to the required formal parameter 'optionsAccessor' 
of 'UserManager<IdentityUser>.UserManager(IUserStore<IdentityUser>, IOptions<IdentityOptions>, 
IPasswordHasher<IdentityUser>, IEnumerable<IUserValidator<IdentityUser>>, 
IEnumerable<IPasswordValidator<IdentityUser>>, ILookupNormalizer, IdentityErrorDescriber, 
IServiceProvider, ILogger<UserManager<IdentityUser>>)'

There is no argument given that corresponds to the required formal parameter 'roleValidators'
 of 'RoleManager<IdentityRole>.RoleManager(IRoleStore<IdentityRole>, IEnumerable<IRoleValidator<IdentityRole>>, 
ILookupNormalizer, IdentityErrorDescriber, ILogger<RoleManager<IdentityRole>>)'

我的ApplicationRole

    public class ApplicationRole : IdentityRole
    {

    }

我的User

    public class User : IdentityUser
    {

    }

我的ApplicationRoleManager

    public class ApplicationRoleManager : RoleManager<ApplicationRole>
    {
        public ApplicationRoleManager(RoleStore<ApplicationRole> store)
                    : base(store)// error here
        {

        }
    }

我的ApplicationUserManager

    public class ApplicationUserManager : UserManager<User>
    {
        public ApplicationUserManager(IUserStore<User> store)
                : base(store) // error here
        {
        }
    }

(使用ASP.NET Core和AspNetCore.Identity)

c# asp.net-core asp.net-identity data-access-layer
1个回答
0
投票

看起来您可能会混合和匹配您的技术。

© www.soinside.com 2019 - 2024. All rights reserved.