Telerik OpenAccess ORM supports mixing of flat and vertical mappings in the same hierarchy. For example, in order to save database space, user is able to use vertical mapping only for seldom-used subclasses with many large fields. Changing the inheritance strategy to vertical have to be done only for these classes and the default settings should be used for the rest.
In the example if both ‘Dog’ and ‘Cat’ strategies are changed to vertical with ‘WeinerDog’ and ‘Rottweiler’ left flat, the hierarchy will be mapped to three database tables as shown below. A discriminator column (‘voa_class’) is added to the base table to distinguish between ‘Dog’, ‘WeinerDog’ and ‘Rottweiler’.
In the App.config file this mapping configuration looks like this:
App.config: |
Copy Code |
... <mapping> <namespace name="Inheritance.Model"> <class name="Cat"> <extension key="db-inheritance" value="vertical" /> </class> <class name="Dog"> <extension key="db-inheritance" value="vertical" /> </class> <class name="Pet" /> <class name="Rottweiler" /> <class name="WienerDog" /> </namespace> </mapping> ... |