Chapter 15. Defining EDM Mappings That Are Not Supported by the Designer

In Chapter 14, you learned many ways to customize the conceptual model using the Entity Model Designer (EDM). The model’s schema supports even more mappings beyond those which you can achieve with the Designer.

In this chapter, you’ll learn how to modify the XML manually to benefit from the more commonly useful of these additional features of Entity Framework: model-defined functions, table per concrete type inheritance, and QueryView. How this impacts your work depends on which unsupported customization you are using. Unsupported features can affect the use of the Designer in the following ways:

  • The feature does not appear in the Designer. This is the most common.

  • The Designer goes into Safe Mode when you attempt to open the model in the Designer. Safe Mode presents a message that indicates the model cannot be opened in the Designer, and displays a link to open the model in XML view.

  • The Mapping Designer goes into Safe Mode, but the CSDL Designer displays.

As we walk through the following mappings, I will indicate how each mapping is handled (or not handled) by the Designer.

Using Model-Defined Functions

Model-defined functions are new to Entity Framework 4. In the previous version of Entity Framework, you could create a new property based on other properties in a model only if you created that new property as a class property. In Chapter 11, you created custom properties. Although they are convenient, they have ...

Get Programming Entity Framework, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.