Inheritance is the way to express 1:1 relationships and provide data and behavior sharing between entities.
Here is an example of how entity inheritance might work:
entity A as EntityBase
field auto id int aid;
field nullable string Data;
field datetime Date;
entity B : A on aid=bid as EntityBase
field id bid;
field string BData;
entity C : A on aid=cid as EntityBase
field id cid;
hide field Data;
field string CData;
hide keyword would only be valid on entities that inherit from other entities and can only be applied to
nullable fields or relationships that rely on nullable fields.
- The classes generated for B & C would not litterally inherit from A but the stored procedures generated would use Joins between the B & C tables to join with A to retrieve the non-hidden data based on the key's specified in the inheritance specifier.
- It is not possible to inherit from multiple entities but it is possible to chain inheritance over N entities deep (Meaning D could inherit from C or B).
- You must use a
using, or full
family name of an
entity for sideways or deeper inheritance.