Reputation: 5223
In my project I have:
public class BaseEntity {
[Key]
public int Id {get; set; }
}
Then I have to define 10+ POCO classes to define the tables in my database:
public class MyTable : BaseEntity {
//define properties here
}
Of course, because MyTable
inherits from BaseEntity
I get that Discriminator field. I want to get rid of the Discriminator
field as I do not need the table BaseEntity
to be created nor I need to implement some sort of inheritance into my database.
Is it possible?
Upvotes: 5
Views: 3027
Reputation: 4997
A couple options:
BaseEntity
abstract
modelBuilder.Ignore<BaseEntity>()
in yourDbContext.OnModelCreating
Upvotes: 11