gpt4 book ai didi

asp.net - MVC5中IdentityDbContext和IdentityDbContext有什么区别

转载 作者:行者123 更新时间:2023-12-02 16:46:30 24 4
gpt4 key购买 nike

应该在什么基础上决定使用 IdentityDbContextIdentityDbContext<ApplicationUser>在 ASP.NET MVC5 应用程序中?

使用IdentityDbContext<ApplicationUser>给我们带来什么好处而不是非通用的IdentityDbContext

最佳答案

IdentityDbContext<ApplicationUser>会让您使用自己的 ApplicationUser类为User实体。 IE。您可以为您的用户设置自定义属性。 IdentityDbContext类继承自 IdentityDbContext<IdentityUser>这意味着您必须使用 IdentityUser为您的用户提供的类(class)。

如果您想在用户对象上拥有比 IdentityUser 的少数属性更多的属性,提供(UserName、PasswordHash 等),那么您可能需要选择 IdentityDbContext<ApplicationUser>

关于asp.net - MVC5中IdentityDbContext和IdentityDbContext<ApplicationUser>有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20281074/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com