我有这段代码:
...
var _context = new MyDbContext();
var _userManager = new UserManager<User>(new UserStore<User>(_context));
...
public bool IsInRole(string userId, string roleName)
{
return _userManager.IsInRole(userId, roleName); //InvalidOperationException
}
引发此异常:
类型&#39; System.InvalidOperationException&#39;的例外情况发生在mscorlib.dll中但未在用户代码中处理
附加信息:序列包含多个元素
Visual Studio 2015
.NET 4.5
Microsoft AspNet Identity Core 2.2.1
实体框架6