Evaluating as substitute for SubSonic, but immediately get voa_keygen

4 posts, 0 answers
  1. AJ
    AJ avatar
    33 posts
    Member since:
    Jun 2011

    Posted 16 Feb 2012 Link to this post

    I wanted to start with something I thought would be extremely basic, but I'm already getting some issues. I have searched and read up on a lot of other voa_keygen issues, but I'm not sure why I'm getting it since I'm querying a table and have confirmed that the Identity Mechanism on that table is DatabaseServerCalculated.

    Basically, all I wanted to do was create a RadGrid with Auto Generate Columns and have the following for the code behind. 

    using(var dbContext = new AMOA.EntitiesModel())
    {
             rgUsers.DataSource = (from u in dbContext.Users select u);
    }

    But I get the "Invalid object name 'voa_keygen'. error. I even went through all my other tables to ensure that the Identity Mechanism was set to DatabaseServerCalculated. The only objects that don't have that are Views. Do I honestly have to go through all those and change them?
  2. AJ
    AJ avatar
    33 posts
    Member since:
    Jun 2011

    Posted 16 Feb 2012 Link to this post

    I did run the following query to create the voa_keygen table in the database; however, when I try to run "Update from Database" it doesn't show up in the list of tables. Using the exact same connection string, Subsonic picked up on the new table right away.

    CREATE TABLE [voa_keygen] (
       [TABLE_NAME] varchar(64) NOT NULL,
       [last_used_id] INT NOT NULL,
       CONSTRAINT [pk_voa_keygen] PRIMARY KEY ([TABLE_NAME])
    )
    GO

    I'm completely lost now... 
  3. DevCraft banner
  4. AJ
    AJ avatar
    33 posts
    Member since:
    Jun 2011

    Posted 20 Feb 2012 Link to this post

    Any advice?
  5. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 20 Feb 2012 Link to this post

    Hi AJ,

    I am afraid that the correct way to solve this problem is by selecting primary key properties for the classes mapped to views. Otherwise read operations on these views will not work properly and the presence of the voa_keygen table would not help. For more details you could have a look at this article - How to: Work with Views and Classes Without Primary Key.

    Please note that the voa_keygen table is used internally (it is not needed in the model) and that is why it is filtered and not displayed in the OpenAccess wizards.

    Kind regards,
    Alexander
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top