The Discriminator
column is used and required in Table-Per-Hierarchy inheritance scenarios. If you for example have a model like this …
public abstract class BaseEntity
{
public int Id { get; set; }
//...
}
public class Post : BaseEntity
{
//...
}
public class OtherEntity : BaseEntity
{
//...
}
… and make the BaseEntity
part of the model, for instance by adding a DbSet<BaseEntity>
to your derived context, Entity Framework will map this class hierarchy by default into a single table, but introduce a special column – the Discriminator
– to distinguish between the different types (Post
or OtherEntity
) stored in this table. This column gets populated with the name of the type (again Post
or OtherEntity
).