I am trying to use the ORM against my database on sql server 2005.
I followed some tutorials using Northwind database and end up witout any problem. but when I create a model from my database and try to add an entity to a table I get a voa_keygen error.
I think it's a problem with my database configuration but can't find which one.
I connect using a a user that is dbowner. Should my user need to be something else.
Thanks for any help
Regis
13 Answers, 1 is accepted


Thanks for your reply.
I am not dealing with a view.
As per your advice, I checked some of the tables (there are more than 40 tables in the schema). the primary key is defined in the database. in the model the primary key are correctly displayed with the small icon and identity it set in properties.
Everything seem all right on this side.
Thank you
Regis

There are two ways to avoid this error:
Damyan Bogoev
the Telerik team

I think I find the reason why i get this error. I discover that for some obscure reasons I have several tables that don't have a primary key.
even if the tables i was dealing with all have a PK and correct FK apparently the fact that others table don't have a primary key affect all kind of insert.
I redo a model with just the tables i need instead of grabbing the whole schema and the insert works perfectly.
Thank you for inlighting me.

Glad to see you were to get it working. I mentioned that in my previous post that if you had any table in the domain model that did not have a primary key it would cause the entire solution to fail, even if the tables you were working with did have correct primary keys.
"Well I know the problem will occur regardless of whether or not you are running an active query on the specific table or view that is causing the issue. As long as it is in the Domain Model it may be causing the issue."
This is not an issue in the product. When the Identity Mechanism of a specific type is not explicitly set, the default setting is used which is HIGHLOW key generator. When the HIGHLOW key generator mechanism is being used, OpenAccess requires the voa_keygen table to be present in the database as that is the table where it preserves the last used id values for each table that has this identity mechanism.
When you first initialize a context or create a Database object as an entry point to OpenAccess, the runtime collects all of the metadata required in order to operate correctly with a certain persistent model. If there are problems with the metadata, OpenAccess throws exception regardless of whether you have accessed the exact entity that causes the invalid metadata or not.
Sincerely yours,
the Telerik team

Can you point to us for a specific topic that you referred in you previous letter. We will surely update the documentation, it seems it is a leftover from some older help topic from the old wizards mapping approach. In the visual designer it is enough to leave the Identity mechanism to "Default" and just set a particular member as an Identity member - that solves the issue for this scenario.
Best wishes,Zoran
the Telerik team

Had the same problem. Damyan was right on the spot. I did not have a primary key for my table. As soon as I set it, it worked.
Regards and thanks Markus

Thanks, guys!
-Ray.

I'm about ready to turn back to EF because of the effort this is taking.
Thank you for the feedback.
We understand that this error can be very frustrating. For that reason we have created a validation rule that will help you identify all of those cases, and a validation action that can fix them for you. I am not sure if we can actually make this process more automated, as in the absence of a primary key column if would be risky for OpenAccess ORM to try guessing the best option - it is much better to leave that choice to you. As for the specific case of the database views, we do plan to improve the process of reading them from the database so that we can have an idea what should the identity be. However, I cannot yet provide you with a time frame for releasing that feature.
What we have done recently for Q3 2012 (already live) is to change the warning that a persistent type doesn't have a primary key to an error, which means that even on the Visual Designer surface you know that the model will have serious problems during runtime.
I hope that helps.
Kind regards,
Ivailo
the Telerik team