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.
OpenAccess ORM is now Telerik Data Access
. For more information on the new names, please, check out the Telerik Product Map