我在 IdentityUser 中添加一些字段,例如
public class CustomUser: IdentityUser
{
public string field1 {get;set;}
public string field2 {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
迁移后,在 Sql Management studio 上我拥有所有数据,我添加了.OnModelCreating
但是,我如何从当前授权的 CustomUser 中获取任何字段(如 ID)
我尝试使用
using Microsoft.AspNet.Identity;
CustomUser.Identity.GetUserId()
Run Code Online (Sandbox Code Playgroud)
但这不起作用。
感谢帮助!