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

Invalid object name 'voa_keygen'

4 Answers 931 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Eric Krauska
Top achievements
Rank 1
Eric Krauska asked on 19 Jan 2011, 08:53 PM
Brand new project using EntityDiagram.  All tables were pulled from the DB and the primary key for each table is a guid.  Upon the first call to our DataContext, we get the below error.  All the posts on the forum I've found relating to this error are for the "Classic" version of OpenAccess, so I have been unable to figure out what is going on here.  Any help is appreciated.

Code that raises the exception:
using (DAL.BarcodeDataContext dal = new DAL.BarcodeDataContext())
{
    DAL.User user = (from n in dal.Users where n.LoginID == username && n.Password == password select n).Single();
    if (user != null) return true;
    else return false;
}

Exception raised:
Invalid object name 'voa_keygen'. Telerik.OpenAccess.RT.sql.SQLException: 
Invalid object name 'voa_keygen'.<BR>   at 
Telerik.OpenAccess.RT.Adonet2Generic.Impl.StatementImp.executeQuery(String sql)

4 Answers, 1 is accepted

Sort by
0
Eric Krauska
Top achievements
Rank 1
answered on 19 Jan 2011, 08:59 PM
Sorry, I just figured this out.  The exception is not a friendly one at all.  It ends up the error was caused by a View that was mapped to a persistent type and the view did not have a primary key specified.  I removed the mapping the view and all is well.  
0
Alexander
Telerik team
answered on 20 Jan 2011, 05:36 PM
Hello Eric Krauska,

This table is required by OpenAccess when one or more classes in the model use internal identity. Internal identity means that the persistent class does not have an identity member defined and this should be handled automatically. The implementation of this mechanism uses the HighLow keygenerator and that is why OpenAccess needs the "voa_keygen" table to store some system values.
By default classes mapped to database views are not generated with identity members and OpenAccess treats them as classes with internal identity. If all classes in your model have identity members and their IdentityMechanism property is not set to Default or HighLow, you should not observe this error.
Hope that helps.

All the best,
Alexander
the Telerik team
Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
0
Ken
Top achievements
Rank 1
answered on 22 Sep 2011, 12:58 PM
Hello, regarding the last sentence in your response (If all classes in your model have identity members and their IdentityMechanism property is not set to Default or HighLow, you should not observe this error.) I assume this means all non sql view classes which don't require the identity mechanism. I have my PK columns set up as guid and the key generator set to

[

 

KeyGenerator(KeyGenerator.Guid)].

 

Why do I still get this error?

Thanks Ken
0
Alexander
Telerik team
answered on 27 Sep 2011, 03:32 PM
Hello Ken,

I just verified that having only classes with Guid identity should not require the voa_keygen table to be present in the database. It would be best if you could send us your rlinq file in a support ticket, so we can have a look at the model and find the reason why this table is needed in your case. 

Kind regards,
Alexander
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>

Tags
Databases and Data Types
Asked by
Eric Krauska
Top achievements
Rank 1
Answers by
Eric Krauska
Top achievements
Rank 1
Alexander
Telerik team
Ken
Top achievements
Rank 1
Share this question
or