I needed to add an extra field to Role identity table in ASP.NET MVC 5.
I use migrations.
I have added an extension to role like:
public class ApplicationRole : IdentityRole
{
public ApplicationRole() : base() { }
public ApplicationRole(string name)
: base(name)
{
}
public virtual Project Project { get; set; }
}
My migration class, I'm getting is:
public partial class ProjectToIdentity : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.Projects",
c => new
{
ID = c.Int(nullable: false, identity: true),
ProjectName = c.String(maxLength: 100),
})
.PrimaryKey(t => t.ID);
AddColumn("dbo.AspNetRoles", "Discriminator", c => c.String(nullable: false, maxLength: 128));
AddColumn("dbo.AspNetRoles", "Project_ID", c => c.Int());
CreateIndex("dbo.AspNetRoles", "Project_ID");
AddForeignKey("dbo.AspNetRoles", "Project_ID", "dbo.Projects", "ID");
}
public override void Down()
{
DropForeignKey("dbo.AspNetRoles", "Project_ID", "dbo.Projects");
DropIndex("dbo.AspNetRoles", new[] { "Project_ID" });
DropColumn("dbo.AspNetRoles", "Project_ID");
DropColumn("dbo.AspNetRoles", "Discriminator");
DropTable("dbo.Projects");
}
}
The question is - what is a Discriminator column? I have no such column in my model. Why does migration tool adds this field and what aim does it have?