我刚开始使用新的2.0版本的身份框架.在1.0中,我可以使用manager.FindByIdAsync(User.Identity.GetUserId())
获得用户对象.GetUserId()
方法似乎不存在于2.0中.
现在我只知道使用manager.FindByEmailAsync(User.Identity.Name)
,它引用了users表中的username字段.在我的应用程序中,这与邮箱字段设置相同.
我可以看到,当有人需要更新他们的邮箱时,这会导致问题.在Identity 2.0框架中,有没有办法根据不变的值(such as the id field)获取当前登录的用户对象?