Microsoft.AspNet.Identity.UserManager没有更多的同步调用?

时间:2013-12-18 12:49:57

标签: asp.net-identity

似乎所有UserManager调用现在都是异步的(基于每晚构建,例如:UserManager.IsInRole已被删除)。这不仅创造了大量的工作(我继承了Controller并覆盖OnActionExecuting然后使用UserManager),而且还中止了“无效的列名'IsConfirmed'。\ r \ n无效的列名'IsConfirmed'。\ r \ n无效的列名'IsConfirmed'。” - 是的,三次。

执行堕胎的代码行:

bool inRole = await um.IsInRoleAsync(userId, role.Name).ConfigureAwait(false);

无论传递给ConfigureAwait的布尔值如何。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

你试过吗

private UserManager<TenantUser> usermanager= new UserManager<TenantUser>(new UserStore<TenantUser>(_dbContext));

bool isUserInRole = usermanager.IsInRole(Thread.CurrentPrincipal.Identity.GetUserId(), "Admin");