繁体   English   中英

如何在 ASP.NET Core 3.1 中的 AspnetUser 中添加列?

[英]How to add column in AspnetUser in ASP.NET Core 3.1?

我创建了一个具有以下属性的类应用程序用户:

 public class ApplicationUser:IdentityUser
 {
    public string RandomPassword { get; set; }
 }

我已将启动更新为:

services.AddIdentity<ApplicationUser, IdentityRole>(options => options.SignIn.RequireConfirmedAccount = true)
            .AddEntityFrameworkStores<ApplicationDbContext>().AddDefaultTokenProviders();

但我正在迁移为空。我希望 RandomPassword 作为 AspNetUser 表的列。

您可能在 DbContext 中缺少此定义

public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
   // omitted 
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM