views:

56

answers:

1

I want to have an abstract class Employee, and 2 derived classes; Staff and Operative. In my DB design, I have an Employee table and an EmployeeType table. The Employee table contains 2 rows, one with Staff lookup data and the other with Operative lookup data. Using EF4, how do I transform this DB structure into a class design specifies above?

+1  A: 

I think I understand what you are asking...so assuming you have three table: Employee, Staff, and Operative. You want Employee to be an abstract class that is the base for Staff and Operative. In the database you have FKs in the Employee table to the Staff and Operative tables.

In EF just create the entities from all three tables. In the properties of the Employee entity, set Abstract = true. In the Staff and Operative entities set Base Type = Employee. That should setup the inheritance you are looking to achieve.

Dan H