Duplicate foreign keys when renaming ASP.NET Identity tables

前端 未结 1 1491
伪装坚强ぢ
伪装坚强ぢ 2021-02-04 02:56

I followed the advice in this question to rename my ASP.NET Identity tables:

modelBuilder.Entity().ToTable(\"UserClaim\");
modelBuilder.         


        
相关标签:
1条回答
  • 2021-02-04 03:24

    You should skip the following line, then it works perfectly well:

    modelBuilder.Entity<IdentityUser>().ToTable("User");
    

    So the only mapping you need is:

    modelBuilder.Entity<IdentityUserClaim>().ToTable("UserClaim");
    modelBuilder.Entity<IdentityUserRole>().ToTable("UserRole");
    modelBuilder.Entity<IdentityUserLogin>().ToTable("UserLogin");
    modelBuilder.Entity<IdentityRole>().ToTable("Role");
    modelBuilder.Entity<ApplicationUser>().ToTable("User");
    

    Hope that helps.

    0 讨论(0)
提交回复
热议问题