如何在 Identity 3.1 中自定义用户?
How can i Customize User In Identity 3.1?
所以,我想修改我的 User
模型,我想添加一个名为 FullName
的新 属性(这是一个 string
)到我的用户模型.
我是 Identity
的新手,我不知道我该怎么做。
我正在使用 Razor Pages Web Application
项目并且身份 3.1 工作正常,但我需要向我的用户添加 FullName
属性。
我看过微软的文档和其他一些帖子,但我不明白:(
您将必须创建自己的 User
class,比方说 ApplicationUser
,这将必须扩展 IndentityUser
class,所以ApplicationUser
和 FullName
的示例如下所示:
public class ApplicationUser : IdentityUser
{
public string FullName { get; set; }
}
您可能还需要调整您的 DbContext
class,可以分享一下吗?
所以,我想修改我的 User
模型,我想添加一个名为 FullName
的新 属性(这是一个 string
)到我的用户模型.
我是 Identity
的新手,我不知道我该怎么做。
我正在使用 Razor Pages Web Application
项目并且身份 3.1 工作正常,但我需要向我的用户添加 FullName
属性。
我看过微软的文档和其他一些帖子,但我不明白:(
您将必须创建自己的 User
class,比方说 ApplicationUser
,这将必须扩展 IndentityUser
class,所以ApplicationUser
和 FullName
的示例如下所示:
public class ApplicationUser : IdentityUser
{
public string FullName { get; set; }
}
您可能还需要调整您的 DbContext
class,可以分享一下吗?