This project is read-only.
Domain driven design would not have been complete if inheritance strategies were not integrated into Rapid. Rapid now supports several inheritance strategies namely :
  • Discriminatory Inheritance (Table Per Hierarchy (TPH)): : This strategy maps subclasses to a single entity base class using Discriminatory standards. Child entities are mapped with DiscriminatorValue("Discriminator", "NonPerishable") attribute, the first parameter is the column which will discriminate the subclass, the second parameter is the value inserted into the discriminator table. For example, if we have a Person class and we want Employee and Customer classes to inherit from the Person class using the discriminatory strategy, we would mark the Person class with Entity attribute, and then we would map both the Employee and Customer classes with the discriminator attribute : More details can be found here Discriminatory Relationship
  • Table per subclasses in hierarchy : This inheritance strategy allows for subclasses to be mapped as entity and the parent class not mapped at all. This gives us the abilities to maintain shared properties within the base class. For example if our Person class is not mapped with entity attribute, and our Employee and Customer classes are mapped with entity properties, suppose there is a property called FirstName which is common to both classes, the best place to put such property, would be in the parent Person class.
  • Table Per Type (TPT) : Rapid to ensure it conforms to Object mapping standards. This allows all Parent and child classes to be mapped as entities to different tables. The parent class owns the join primary keys while the child classes hold foreign keys. Note your child class might have its own key too, but the parent key is used internally by rapid to generate the join query.

Last edited Feb 7, 2010 at 8:02 PM by ahmedsalako, version 2


No comments yet.