I'm facing some problems working with EF DB First. Say I've got:
- A table Person
- A table Student with a foreign key pointing to Person
- A table Teacher with a foreign key pointing to Person
The model created from the database generates the next classes:
public class Person{
this.Student= new HashSet<Student>();
this.Teacher= new HashSet<Teacher>();
}
public class Student{}
public class Teacher{}
And what I'd really like to see is
public class Person{}
public class Student:Person{}
public class Teacher:Person{}
Is there any convention over configuration or anything I'm missing to get the inherited classes ?
UPDATE
Classes are generated in such a way because the model specifies these associations between Person, Teacher and Student. My question should be then...Is there any way to create a model from a DB using EF so that the model contains classes that inherit from other ones?