Inheritances

LinqConnect supports single-table mapping, whereby an entire inheritance hierarchy is stored in a single database table. The table contains the flattened union of all possible data columns for the whole hierarchy and each row has nulls in the columns that are not applicable to the type of the instance represented by the row.

For inheritance relationship, you should set Discriminator Property which determines which class or subclass this row of data belongs to. You should also set values for class discriminator for parent and child classes. A default inheritance class should be also specified for the case when the discriminator value from the database table does not match any class discriminator value.

On the diagram, inheritance relationships are represented as solid line connections with white arrows.

 

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_inheritanceeditor

In Inheritance Editor, you should set parent and child classes, the discriminator property, and discriminator values. When you specified all the inheritance relationships for the hierarchy with the same root, open one of the relationships and specify the Inheritance Default class.

 

ExpandedToggleIcon        See Also


Send feedback on this topic

© 2008 - 2024 Devart. All rights reserved.