This is a migrated thread and some comments may be shown as answers.

Share descendant's table mapping

3 Answers 33 Views
Feature Requests
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Pål
Top achievements
Rank 1
Pål asked on 09 Nov 2011, 01:05 PM
Hi.

I would love to see the following functionality in future versions:

Background:
I have a base abstract perstent class with identity and version fields (ID, Version), which is mapped to a table 'PersistentObject'. All my persistent classes derives from this class, which means they all put an entry into this table on creation.

This table will of cource then grow very large over time and i would like to use separate tables for separate classes, with their own version/id columns.

One way to achieve this is to declare the class fields protected and do the mapping in the descendant classes, but this means exposing direct write access to fields which should alwas be read-only to both users and developers, and this poses a high risk. It also requires mapping be set up for the same fields in every class, which is error prone and time consuming.

What I would like to do, is what I've seen with another ORM vendor, to map the fields in the base class, but specify on a class (field even) that fields mapped in this class should use the table mapped by it's descendants. Recursively of course, should the descendant also specify this behaviour.

Thanks

Pål

3 Answers, 1 is accepted

Sort by
0
Zoran
Telerik team
answered on 14 Nov 2011, 03:11 PM
Hello Pål,

I believe that the horizontal inheritance feature should allow you to achieve the goal that you have described in your last post. If you allow OpenAccess to automatically do the mapping for you, you will not have to specify mapping for your properties on each class separately.  Specifying the mapping on class level is also possible if necessary.

Best wishes,
Zoran
the Telerik team

NEW and UPDATED OpenAccess ORM Resources. Check them out!

0
Pål
Top achievements
Rank 1
answered on 14 Nov 2011, 04:04 PM
Hi.

Can you show me how to implement this using the 'classic' mapping model please?

Thanks

Pål
0
Jan Blessenohl
Telerik team
answered on 14 Nov 2011, 08:25 PM
Hello Pål,
Please add the horizontal setting to your mapping like this:
<class name="HorzBaseFilePKFields">
  <extension key="db-inheritance" value="horizontal" />
</class>


Regards,
Jan Blessenohl
the Telerik team

NEW and UPDATED OpenAccess ORM Resources. Check them out!

Tags
Feature Requests
Asked by
Pål
Top achievements
Rank 1
Answers by
Zoran
Telerik team
Pål
Top achievements
Rank 1
Jan Blessenohl
Telerik team
Share this question
or