Inheritance strategies

Introduction

pmMDA.NET supports the same three inheritance strategies as NHibernate. The tagged value ".net-nh-inheritance-strategy" is used to define the inheritance strategy. ".net-nh-inheritance-strategy" is only relevant for data objects which don't derive from another object. This means the strategy of the base data object is used for the whole class hierarchy (All classes which somehow derive from the same data object).
It is possible to mix the strategies in your pmMDA Model but not in the same class hierarchy.

Strategies

Table per subclass

Each class has its own table. The table of a data object, which doesn't derive from an other object, contains the id and timestamp columns. The table of a data object, which derives from another data object, has a foreign key association to the base (or super) class, and therefore doesn't need an own id and timestamp column.

Table per concrete class

Each class has its own table. Each table has its own id and timestamp column. The table has columns for all properties, even for the derived ones.
The NHibernate Table per concrete class, using implicit polymorphism is used to implement the pmMDA "Table per concrete class" strategy.

Table per class hierarchy

A table exists only for data object which doesn't derive from another object. This table has an id and a timestamp column. The table also contains columns for all properties which are defined by all the data objects in the same class hierarchy.
Because different types are stored into the same table, a discriminator column is used. The value of this discriminator specifies the type of the data object for the whole row. In pmMDA the discriminator column is always named as "TYPE".

Example

MDA model Table per subclass Table per concrete class Table per class hierarchy
class diagram Table per subclass Table per concrete class Table per class hierarchy

Limitations

Note that some inheritance strategies have limitations which are described here.