[英]How to add column in AspnetUser in ASP.NET Core 3.1?
I have created a class Application User with following properties:我创建了一个具有以下属性的类应用程序用户:
public class ApplicationUser:IdentityUser
{
public string RandomPassword { get; set; }
}
And I have updated startup as:我已将启动更新为:
services.AddIdentity<ApplicationUser, IdentityRole>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<ApplicationDbContext>().AddDefaultTokenProviders();
But I am getting migration to be empty.I want RandomPassword as column of AspNetUser table.但我正在迁移为空。我希望 RandomPassword 作为 AspNetUser 表的列。
Your are presumably missing this definition in the DbContext您可能在 DbContext 中缺少此定义
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
// omitted
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.