The Table Per Concrete (TPC) Type inheritance (in Telerik Data Access terms, Horizontal inheritance) is an inheritance that is used when the database contains two or more tables with sets of identical columns.
For example, suppose that in the database we have the TPC_Horse and TPC_Dog tables. Both these tables contain the following identical columns: BirthDate and Genus.
Within the Database First approach, used for the purpose of this example, first, we move the TPC_Horse and TPC_Dog tables onto the design surface to create classes with the same respective names:
Next, we move identical properties (BirthDate and Genus) from one of the classes onto the diagram surface. Note that we cannot move the ID property, because in Telerik Data Access the derived classes must have primary keys in Horizontal hierarchy.
This displays the following dialog box:
In the dialog box above, we select New base class and enter a name for the abstract class, for example, TPCBaseEntity, and click OK.
Open the Inheritance Editor dialog box for the created inheritance and select Table Per Concrete Type in the Type combo-box:
At this stage, a TPC inheritance is created between the class, from which we moved the identical properties and the TPCBaseEntity class. The model looks as follows:
In the Properties window of the TPCBaseEntity class, we set Abstract to True.
Now we shall move the identical properties from the other class onto the diagram surface. The Model Refactoring dialog box is displayed again with the following selection:
If the automatic selection of the parameters is different, it will be necessary to select the Existing base class and select the TPCBaseEntity class from the corresponding drop-down list.
When we click OK in the dialog box, we get the final version of the model with correctly set inheritances: