user2225591
user2225591

Reputation: 21

Entity Framework Code First Inheritance - multiple types

i'm using Entity Framework Code First Table-per-Type Inheritance. I want to model this issue:

I've got one base class called: User. And two derived classes:

public class Student : User{}
public class Teacher : User {}

So now I want to be able to insert a User that is a Teacher and also a Student. As far I know this is not possible in this approach. So how can I solve this in Code First ? And how would a sample insert look like ?

Thanks a lot

Upvotes: 0

Views: 199

Answers (1)

Alexandr Mihalciuc
Alexandr Mihalciuc

Reputation: 2577

You guess you need to create another class called public class TeachingStudent: User and use it for such cases

Upvotes: 0

Related Questions