Chapter 15. Advanced Modeling

The Entity Framework runtime supports a surprisingly wide variety of modeling scenarios, even if the current implementation of the designer does have some limitations. In this chapter, we explore some of the more advanced modeling concepts that are supported by Entity Framework. Many of these models represent real-world challenges dealing with existing databases that may not have been designed with the best approaches.

Creating an Association on a Derived Entity

Problem

You have a table with a nullable foreign key column. You want to model the table using Table per Hierarchy inheritance and map the foreign key column as an association on the derived entity.

Solution

Let's say you have a couple of tables like the ones shown ...

Get Entity Framework 4.0 Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.