在MVC5中IdentityDbContext和IdentityDbContext <ApplicationUser>之间有什么区别

San*_*mar 8 asp.net asp.net-mvc entity-framework entity-framework-6 asp.net-mvc-5

凭什么要一个决定使用IdentityDbContextIdentityDbContext<ApplicationUser>在ASP.NET应用程序MVC5?

使用IdentityDbContext<ApplicationUser>而不是非泛型,我们可以获得哪些好处IdentityDbContext

Ola*_*ybø 11

IdentityDbContext<ApplicationUser>会让你使用自己的ApplicationUser类作为User实体.即,您可以为用户提供自定义属性.在IdentityDbContext类继承IdentityDbContext<IdentityUser>,这意味着你将不得不使用IdentityUser类用户.

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