在 ASP.NET MVC5 应用程序中,应该基于什么基础来决定使用 IdentityDbContext
还是 IdentityDbContext<ApplicationUser>
?
与非泛型的 IdentityDbContext
相比,使用 IdentityDbContext<ApplicationUser>
有哪些好处?
在 ASP.NET MVC5 应用程序中,应该基于什么基础来决定使用 IdentityDbContext
还是 IdentityDbContext<ApplicationUser>
?
与非泛型的 IdentityDbContext
相比,使用 IdentityDbContext<ApplicationUser>
有哪些好处?
IdentityDbContext<ApplicationUser>
将让你使用自己的ApplicationUser
类作为User
实体,即你可以在用户上有自定义属性。 IdentityDbContext
类继承自IdentityDbContext<IdentityUser>
,这意味着你必须使用IdentityUser
类来表示你的用户。IdentityUser
提供的少量属性(如用户名、密码哈希等)更多的属性,则可以选择IdentityDbContext<ApplicationUser>
。