Modification Default Identity Table

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");
        }

 

posted @ 2017-03-13 11:23  Javi  阅读(270)  评论(0编辑  收藏  举报