In general, OpenAccess ORM allows you to map more than one class to a single table if the structure of the classes is hierarchical. In other words: if you have the Animal class and the Dog class, you can map them to the same table, if the Dog class inherits the Animal class.
OpenAccess offers different ways to model inheritance hierarchies in a relational database (additional general information
- vertical inheritance mapping - each class has its own table containing only its fields (video
- horizontal inheritance mapping - instead of, the topmost class in a hierarchy to have a table of its own, each immediate subclass is stored in a table with a "copy" of the fields from the superclass (video
- flat inheritance mapping - fields from the subclasses are mapped to a superclass table (video
- complex inheritance mapping - mixing vertical and flat inheritance (video
From the code you posted and since you mention that you use the database first approach, my best guess is that you are trying to implement flat inheritance mapping. If that is the case, in addition to the video you can check here
for a step-by-step guide.
However, if I my assumption is wrong or if you experience any difficulties in the implementation of the inheritance hierarchies in your model, do not hesitate to get back to us.
All the best,
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!