I am using Asp.net MVC and I want to rename identity tables such as AspNetUsers, AspNetRoles, AspNetUserRoles To Users, UserRole, UserwithRoles Please Can any one help me ?
0
votes
1 Answers
0
votes
You can give those tables a custom name of your choice in the OnModelCreating method within your ApplicationDbContext.cs file in the following way:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// custom code here...
modelBuilder.Entity<IdentityUser>().ToTable("User", "dbo");
modelBuilder.Entity<IdentityRole>().ToTable("Role", "dbo");
modelBuilder.Entity<IdentityUserRole>().ToTable("UserRole", "dbo");
modelBuilder.Entity<IdentityUserClaim>().ToTable("UserClaim", "dbo");
modelBuilder.Entity<IdentityUserLogin>().ToTable("UserLogin", "dbo");
modelBuilder.Entity<IdentityUserToken>().ToTable("UserToken", "dbo");
// other custom code here...
}