How to change table names for ASP.net Identity 2.0 with int ID columns?

Grrr…… So after wasting a couple hours on this, I copied my rules and pasted them below the base.OnModelCreating(modelBuilder); line and everything worked properly. I didn’t realize that the base method needed to be called first 🙁

Everything is working properly now using the following configuration:

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder); // This needs to go before the other rules!

    modelBuilder.Entity<User>().ToTable("Users");
    modelBuilder.Entity<Role>().ToTable("Roles");
    modelBuilder.Entity<UserRole>().ToTable("UserRoles");
    modelBuilder.Entity<UserLogin>().ToTable("UserLogins");
    modelBuilder.Entity<UserClaim>().ToTable("UserClaims");
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)