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

OpenAccess ORM Verticle Inheritance Error

1 Answer 25 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Richard
Top achievements
Rank 1
Richard asked on 29 Aug 2013, 09:52 PM
Hello.  I am very new to using Telerik's ORM package.  I am using model first.  I have the model shown in the screen shot.  I do not get errors when it is set to the default inheritance strategy of flat table mapping, however when I change it to vertical mapping I get the errors:

Error    11    The persistent type 'ArchKbModel.Thing' with vertical inheritance strategy has identity members.    C:\dev\tmp\architectureKb\WpfModelTestAppVs2010\ArchKbModel\EntitiesModel.rlinq    0    0    
Error    13    The persistent type 'ArchKbModel.MasterKey' with vertical inheritance strategy has identity members.    C:\dev\tmp\architectureKb\WpfModelTestAppVs2010\ArchKbModel\EntitiesModel.rlinq    0    0    

I want to use an automatically generated GUID as the identity field for all my records.  I only declared a key on Thing which here is field called "Id".

Thank you.

I need the data access layer I produce with the ORM to run in a Sharepoint 2010 web part, so I am using VS 2010 with .NET 3.5 SP1.

1 Answer, 1 is accepted

Sort by
0
Doroteya
Telerik team
answered on 03 Sep 2013, 09:13 PM
Hi Lawrence,

Thank you for contacting us. I reviewed the provided screenshot and based on it I would suggest to you the following resolution for the errors and for implementation of the required scenario:

In order to create a vertical inheritance hierarchy in Telerik OpenAccess ORM, you need to set an identity property only for the base class. Additionally, once the hierarchy is set the base class should be the only one with default Inheritance Strategy (the complete guide through the vertical iheritance setup process is available here).

In other words, in order to resolve the errors you are experiencing, I would suggest to you to nominate either Thing or MasterKey for a base class of the hierarchy and to apply the following settings in Visual Designer:
1. Set the inheritance strategy of the base class to default (as in step 15 from the suggested guide).
2. Remove the identity property of the child class (and its corresponding column, if the class is already explicitly mapped to a table. You can easily achieve that through Table Editor).
3. Save the .rlinq file

Regarding the GUID identity, you could implement it with the help of our GUID Identity Mechanism (the workflow is described here). This identity mechanism allows OpenAccess ORM to generate the GUID value for you, so that you do not have to specify it in your code.

Additionally, please kindly find attached to this message a sample project that demonstrates the implementation of a simple vertical hierarchy with GUID identity. In order to run it, all you need to do is modify the connection string in the .config file and migrate the domain model to the database.

If the suggested solution does not fit in your scenario or if you have additional questions, do not hesitate to get back to us..


Regards,
Doroteya
Telerik
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvementsshipped with this release.

Tags
Data Access Free Edition
Asked by
Richard
Top achievements
Rank 1
Answers by
Doroteya
Telerik team
Share this question
or