C# 为什么EF迁移会添加字段?

C# 为什么EF迁移会添加字段?,c#,asp.net,entity-framework,C#,Asp.net,Entity Framework,我使用Identity 2.0。我有自己的角色 EF添加一个字段CustomRole\u Id 现在我有两个角色字段。我不明白为什么。我不得不写信 base.OnModelCreating(modelBuilder); 之后 虽然我以前写过 public class CustomRoleConfiguration : EntityTypeConfiguration<CustomRole> { public CustomRoleConfiguration(

我使用Identity 2.0。我有自己的角色

EF添加一个字段CustomRole\u Id

现在我有两个角色字段。我不明白为什么。

我不得不写信

 base.OnModelCreating(modelBuilder);
之后

虽然我以前写过

 public class CustomRoleConfiguration : EntityTypeConfiguration<CustomRole>
    {
        public CustomRoleConfiguration()
        {
            Property(r => r.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
        }
    }
            CreateTable(
            "dbo.AspNetUserRoles",
            c => new
                {
                    UserId = c.Long(nullable: false),
                    RoleId = c.Long(nullable: false),
                    CustomRole_Id = c.Long(),
                })
            .PrimaryKey(t => new { t.UserId, t.RoleId })
            .ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
            .ForeignKey("dbo.CustomRoles", t => t.CustomRole_Id)
            .Index(t => t.UserId)
            .Index(t => t.CustomRole_Id);
 base.OnModelCreating(modelBuilder);
modelBuilder.Configurations.Add(new DocumentConfiguration());
modelBuilder.Configurations.Add(new SubvisionConfiguration());
modelBuilder.Configurations.Add(new DocumentActionConfiguration());
modelBuilder.Configurations.Add(new CustomRoleConfiguration());