简体   繁体   English

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

[英]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.

相关问题 如何使用Code First在ASP.NET MVC 5 Identity 2.0中为AspNetUser表(Id列)在Customer表(CreatedBy列)中添加外键 - How to add a Foreign key in Customer table (CreatedBy column) for AspNetUser table (Id column) in ASP.NET MVC 5 Identity 2.0 using Code First asp.net核心3.1启动增加定时器方法 - Add timer method to asp.net core 3.1 startup 如何使用继承将字段添加到.NET Core 2.0中的aspNetUser表 - How to add fields to the aspNetUser table in .NET Core 2.0 using the inheritance 无法在 asp.net 核心 3.1 中添加对 CSharpCompilation 的 MetadataReference 的引用 - Not able to add reference to MetadataReference of CSharpCompilation in asp.net core 3.1 ASP.NET 核心3.1:添加框架服务:IHostEnvironment - ASP.NET Core 3.1: Add framework service: IHostEnvironment 如何在 ASP.NET Core 3.1 中使用 protobuf-net 3 - How to use protobuf-net 3 with ASP.NET Core 3.1 如何使用 ASP.NET Core 3.1 MVC 中的 ViewModel 与 JavaScript 和 C# 动态添加到列表 - How to dynamically add to list with ViewModel in ASP.NET Core 3.1 MVC with JavaScript and C# 如何在 app.UseEndPoints 中将自定义路由操作作为委托实例添加到 ASP.NET Core 3.1 应用程序? - How to add custom routed action as a delegate instance to ASP.NET Core 3.1 app in app.UseEndPoints? 如何在启用 OData 的 Web API 中添加 Swagger 在 Z9E0DA8438E1E38A1C30F4B816Core 上运行 - How to add Swagger in OData-enabled Web API running on ASP.NET Core 3.1 如何在 ASP.NET Core 3.1 MVC 中进行自定义路由 - How to do custom routing in ASP.NET Core 3.1 MVC
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM