【发布时间】:2020-04-25 18:12:28
【问题描述】:
我得到了以下课程:
public class AllRegistrationsViewComponent : ViewComponent
{
private readonly UserManager<IdentityUser> um;
private readonly MyContext myContext;
public AllRegistrationsViewComponent(UserManager<IdentityUser> um, MyContext myContext)
{
this.um = um;
this.myContext= myContext;
}
public async Task<IViewComponentResult> Invoke()
{
var allUsers= await um.Users.ToList();
return View(allUsers);
}
}
我收到以下消息:
List <IdentityUser> does not contain a definition for GetAwaiter and no accessible method
GetAwaiter accepting a first argument of type List<IdentityUser> could be found
【问题讨论】:
-
也感谢 Nathan 的链接
-
@Rob,刚刚更正,感谢您的注意
标签: asp.net-mvc asp.net-core razor async-await task