I have already created ASP.NET MVC Template and its structure look like this.


Now go to Model folder and open the IdentityModels.cs class and modify,
- using Microsoft.AspNet.Identity.EntityFramework;
- namespace Demo.Models
- {
- // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
- public class ApplicationUser: IdentityUser {}
- public class ApplicationDbContext: IdentityDbContext < ApplicationUser >
- {
- public ApplicationDbContext(): base("DefaultConnection") {}
- // add this code
- protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
- {
- base.OnModelCreating(modelBuilder);
- modelBuilder.Entity < ApplicationUser > ().ToTable("tblCustomUser");
- modelBuilder.Entity < IdentityUserRole > ().ToTable("tblCustomUserRole");
- modelBuilder.Entity < IdentityUserLogin > ().ToTable("tblCustomUserLogin");
- modelBuilder.Entity < IdentityUserClaim > ().ToTable("tblCustomUserClaim");
- modelBuilder.Entity < IdentityRole > ().ToTable("tblCustomRole");
- modelBuilder.Entity < IdentityUser > ().ToTable("CustomUserLoginTable");
- }
- }
- }
Step 2: Enable Migration
Open package manager console and run following command,
Open package manager console and run following command,
- enable-migrations
- add-migration customtable
- update-database
After run above command check the database table and its look like this,


So we converted default table to new table name,
AspNetRoles -->tblCustomRole
AspNetUserClaims -->tblCustomUserClaim
AspNetUserLogins -->tblCustomUserLogin
AspNetUserRoles -->tblCustomUserRole
AspNetUser -->CustomUserLoginTable
ApplicationUser -->tblCustomUser

Mohd AnishPosted Apr 17, 2019, 10:42 AM
Hi there, I am Anish here, I working as software developer , now I m working on a project in this project using the identity framework and I have facing some problems,,,how to modify identity related tables likes as aspnetuserclaim tables ....
Piyush AgarwalPosted Mar 10, 2018, 12:18 PM
Thanks for sharing... Just wanted to understand any practical scenario where this can be used... Thanks
Santhakumar MunuswamyPosted Dec 27, 2015, 9:11 AM
Thanks for sharing