如何更改.net核心标识中的表名?

时间:2018-12-17 19:23:19

标签: c# asp.net-core

我正在尝试更改.net核心标识中的所有表名,以使其更加清晰。我的ApplicationDbContext

中有以下内容
public class ApplicationDbContext : IdentityDbContext
{
    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
        : base(options)
    {
    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);
        // Customize the ASP.NET Identity model and override the defaults if needed.
        // For example, you can rename the ASP.NET Identity table names and more.
        // Add your customizations after calling base.OnModelCreating(builder);

        builder.Entity<ApplicationUser>().ToTable("Users");
        builder.Entity<IdentityUserRole<string>>().ToTable("UserRoles");
        builder.Entity<IdentityUserLogin<string>>().ToTable("UserLogins");
        builder.Entity<IdentityUserClaim<string>>().ToTable("UserClaims");
        builder.Entity<IdentityRole>().ToTable("Roles");
    }
}

每当我进行迁移时,我仍然拥有下面的表格:

AspNetRoleClaims AspNetUsers AspNetUserTokens

我希望“用户”成为“用户”,而其他用户则更具可读性。我也有我的ApplicaitonUser模型

public class ApplicationUser : IdentityUser
{

}

我在做什么错了?

0 个答案:

没有答案
相关问题