3
ROLES에 CRUD 작업을 만들어야합니다.AspNetCore 2.0 ID - RoleManager 삽입 문제
그래서, 내가 어떻게으로 roleManager를 주입 할 수 있습니다 " 'Microsoft.AspNetCore.Identity.RoleManager` 유형의 서비스를 확인할 수 없습니다"
나는 다음과 같은 오류를 받고 있어요?
내가 사용 ASP를 그물 코어 2.0 + 정체성 2.2.1
클래스 ApplicationUser
Startup.cs 에서 지금public class ApplicationUser : IdentityUser
{
[Key]
public override string Id { get; set; }
public bool Type { get; set; }
}
services.AddIdentity<ApplicationUser, IdentityRole<int>>()
.AddUserStore<UserStore<ApplicationUser, IdentityRole<int>, ApplicationDbContext, int>>()
.AddRoleStore<RoleStore<IdentityRole<int>, ApplicationDbContext, int>>()
.AddDefaultTokenProviders();
컨트롤러
private readonly UserManager<ApplicationUser> _userManager;
private readonly RoleManager<IdentityUser> _roleManager;
public RolesController(UserManager<ApplicationUser> userManager, RoleManager<IdentityUser> roleManager)
{
_userManager = userManager;
_roleManager = roleManager;
}
public IActionResult Index()
{
return View(_roleManager.Roles);
}
그래서, 나는 "Microsoft.AspNetCore.Identity.RoleManager` 유형의 서비스를 확인할 수 없습니다.