Getting Started with Entity Framework 4.0 Screencast Recorded session from Cairo Code Camp - Part 4

by mosessaur| 07 August 2010| 3 Comments

About Part 4

Fourth part is about 10 min in length. Covers how to implement table per hierarchy inheritance model (TPH) with Entity Framework 4.0

More...

Inheritance and Associations with Entity Framework Part 3

by mosessaur| 01 October 2008| 6 Comments

On part 1 and part 2 I explored how to apply 2 different inheritance models (TPH & TPT) in Entity Framework. In this part I'm going to demonstrate associations between 2 base entities. And how to filter end properties to return specific type (sub entity). Download the sample.

Review Association Ends:

In previous part when I added department tables to the entity model diagram, an associations between Person and Department entities was automatically defined. This relation actually demonstrate the relation between Administrator and Department. It is one-to-many relationship where one person can be administrator of one or many departments.

A collection of Departments is created on Person table and therefor it is inherited on all sub entities! But this make no sense, as a student or instructor has nothing to do with this collection. Beside on the other end at Department a property of type Person is created -I renamed it to Administrator-, while this shouldn't be just any Person, this Person must be of type Administrator.

A few modification should take place in here. The existing association should be deleted and the association ends should be define between Administrator Entity and Department Entity. To do that follow the following steps:

More...