Overview

ExpandedToggleIcon        Hierarchy Types

Entity Developer supports all three hierarchy types - Table Per Type, Table Per Hierarchy, or Table Per Concrete Type. On the diagram, inheritance relationships are represented as solid line connections with white arrows.

In the Table Per Hierarchy hierarchy, all hierarchy classes are mapped to the same table, containing columns for all the properties of the hierarchy and additional ones for discriminating objects of one class from another. In the course of creating a Table Per Hierarchy hierarchy in a model that was autogenerated from a database, the autogenerated table class will become a base class. Drag child class properties out of the parent class and, in the displayed Model Refactoring dialog box, select New derived class. Delete properties, corresponding to columns that determine the class for objects. Repeat this to create all hierarchy classes, then set a mapping condition for the classes.
In the Table Per Type hierarchy, each hierarchy class is mapped to one table. Every table provides additional details that describe a new type based on another table which is that table's parent.
In the Table Per Concrete Type hierarchy, each non-abstract hierarchy class is mapped to one table. To establish such a relationship in a model, autogenerated from a database, drag the properties which belong to the parent class from one of the generated classes and, in the displayed Model Refactoring dialog box, select New base class and enter the base class name. Then drag the corresponding properties of other generated hierarchy classes out and select Existing base class in the displayed Model Refactoring dialog box. Then set the base class inheritance modifier to Abstract and set the inheritance type to Table Per Concrete Type.

 

ExpandedToggleIcon        Creating and Editing Inheritances

To create an inheritance, use the New Inheritance Images_addInheritance button on the Model toolbar or on the Model Explorer toolbar. Or you can right-click the diagram or class and select New Inheritance from the Add submenu of the class shortcut menu. The Inheritance Editor dialog will be displayed.

Images_TPH-inheritance-editor-EF

In Inheritance Editor, you should set the base and derived classes and select a hierarchy type.

note Note

The Discriminator options are available only for Table per Hierarchy (TPH) inheritance.

You can also create or change inheritances by setting the Base Type property for the entities.

Images_basetype_ef

 

ExpandedToggleIcon        See Also


Send feedback on this topic

© 2008 - 2024 Devart. All rights reserved.