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

前端 未结 2 1937
借酒劲吻你
借酒劲吻你 2020-12-04 11:58

I\'ve used ASP.net membership for years and am just starting to try out ASP.net Identity. They just released version 2.0 and which is supposed to support int pr

2条回答
  •  春和景丽
    2020-12-04 12:49

    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().ToTable("Users");
        modelBuilder.Entity().ToTable("Roles");
        modelBuilder.Entity().ToTable("UserRoles");
        modelBuilder.Entity().ToTable("UserLogins");
        modelBuilder.Entity().ToTable("UserClaims");
    }
    

提交回复
热议问题