Modification Default Identity Table

时间:2023-12-19 19:44:26

Step 1. Open IdentityModel.cs to add following code.

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder); // This needs to go before the other rules! modelBuilder.Entity<ApplicationUser>().ToTable("SystemUser").Property(p => p.Id).HasColumnName("UserId");
modelBuilder.Entity<ApplicationUser>().ToTable("SystemUsers").Ignore(p => p.PhoneNumber);
modelBuilder.Entity<IdentityRole>().ToTable("SystemRoles");
modelBuilder.Entity<IdentityUserRole>().ToTable("SystemUserRoles");
modelBuilder.Entity<IdentityUserLogin>().ToTable("SystemUserLogins");
modelBuilder.Entity<IdentityUserClaim>().ToTable("SystemUserClaims");
}