I would like to implement a Layer Supertype pattern ((PoEAA) when using EF 4.x.
Suppose I have a layer supertype class named Entity, from which two classes Teacher and Student inherits.
The class Person is defined like this
class Entity
{
public int Id {get;set;}
}
And Teacher and Student like this
class Teacher : Entity
{
publix string Name {get;set;}
}
class Student : Entity
{
public int Age {get;set;}
}
How can I configure EF 4.x so that in my database, I will just have two tables that corresponds to Teacher and Student ? I tried to use the TPC inheritance strategy to map this structure but it doesn’t fit, it creates three tables one for each concrete class ..
With NHibernate, these kind of situation is quite common and is handled well, I mean if I create mappings for only Person and Student, the database will have only two tables and I do not have to explicitly implement any inheritance startegy.
Thanks for all of your advices
Riana
Make the
Entityclass abstract