How to: Create and Delete Inheritance Relationships (Entity Data Model Tools)
Inheritance enables one entity type to be derived from another entity type in the conceptual model. For example, Employee and Customer types can both inherit from the Contact type. In this case, Contact is called the base type. Employee and Customer are called derived types.
An inheritance relationship is represented on the design surface as a line that connects the base type and the derived type. The connector has a hollow arrow at the end that points to the base type.
Note |
---|
The ADO.NET Entity Data Model Designer does not allow a type to inherit from itself. That is, the source and target ends must be different. |
Create an Inheritance
Creating an inheritance relationship does the following:
Adds the inheritance relationship to the design surface.
Modifies the part of the .edmx file that defines the conceptual data model.
Updates the Mapping Details window.
Updates the Model Browser window.
To create an inheritance relationship from the design surface
Right-click an empty area of the design surface, point to Add, and select Inheritance.
The New Inheritance dialog box appears.
Select the base and derived entity types.
Click OK.
The inheritance relationship is created.
To create an inheritance relationship using the Toolbox
Select the Inheritance control from the Toolbox.
Click the subtype entity on the designer surface and then click the base type on the designer surface.
The inheritance relationship is created.
To create an inheritance relationship from a selected entity
Select an entity from the design surface, point to Add, and select Inheritance.
The New Inheritance dialog box appears. The selected entity is listed as the base entity.
Select the derived entity type.
Click OK.
The inheritance relationship is created.
To create an inheritance relationship using the Properties window
Select an entity.
From the Properties window, select the base type for the inheritance relationship from the Base Type drop-down list.
The inheritance relationship is created.
Delete an Inheritance
Deleting an inheritance relationship does the following:
Removes the inheritance relationship from the design surface.
Modifies the part of the .edmx file that defines the conceptual data model.
Sets the Base Type property of the derived types to (None).
Updates the Mapping Details window.
Updates the Model Browser window.
To delete an inheritance relationship
Right-click the inheritance and select Delete.
-or-
Select one or more inheritances and press the DELETE key.
See Also
Tasks
Walkthrough: Mapping Inheritance - Table-per-Hierarchy (Entity Data Model Tools)
Walkthrough: Mapping Inheritance - Table-per-Type (Entity Data Model Tools)
Concepts
ADO.NET Entity Data Model Designer