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

Another 'voa_keygen' issue

1 Answer 37 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.
Mark
Top achievements
Rank 1
Mark asked on 14 Jun 2014, 03:47 PM
I've read all of the old posts as well as the blog posts on this subject.  All of them indicate that this is related to either entities that don't have a PK, or PK's using the hi-lo key generator; and in some cases using views.  All of my entities using GUIDs with the IncrementalGuid key generator, except one which is an Integer and use the DatabaseServerCalculated.

And yet I continue to get this error; if I create the table everything functions as I would expect and I get no errors.  Is this just a required table to use Telerik Data Access?

1 Answer, 1 is accepted

Sort by
0
Doroteya
Telerik team
answered on 18 Jun 2014, 10:55 AM
Hello Mark,

In general, Telerik Data Access needs every persistent class to have at least one persistent property marked as its identity. In other words, regardless of the key generator, there should be a property for which the Identity property is set to True.

For example, if you have the User persistent class with the following properties: UserID of type GUID, UserName of type String and Password of type String, for .rlinq files, the Identity property of UserID should be True, and for fluent models the IsIdentity(KeyGenerator keyGen) method should be called in the configuration of the property. In case User has no property marked as identity, the first query your code issues against the database will result in the error you experience, even if you query a completely different persistent class.

With this in mind, to resolve the situation on your side if you have an .rlinq file, you can check in Error List, if it contains an error with text that follows this pattern: The persistent type <type_name> has no primary key specified. If it does, you can double-click on the error and our Validation dialogue will open to assist you in the resolution process.

If you have a fluent model, you need to go through the mapping configuration of each persistent class and make sure that the IsIdentity() method is called for the appropriate properties.

In case this does not work for you, do not hesitate to get back to us.



Regards,
Doroteya
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
Data Access Free Edition
Asked by
Mark
Top achievements
Rank 1
Answers by
Doroteya
Telerik team
Share this question
or