Upgrade to Domain Model

4 posts, 0 answers
  1. jon
    jon avatar
    33 posts
    Member since:
    Dec 2008

    Posted 03 Sep 2010 Link to this post

    We were using ReverseMapping and the ScopeProvider with a ScopeFactory, according to the best practice. 
    Now we are upgrading to use the Domain Model, and we're having trouble with this error:
      "Telerik.OpenAccess.RT.sql.SQLException: Invalid object name 'voa_keygen'."

    We read through the other forum posts on this issue, but its not helped.
    http://www.telerik.com/community/forums/orm/databases/invalid-object-name-voa-keygen.aspx
    http://blogs.telerik.com/blogs/posts/10-07-16/openaccess_orm_upgrade_model_tool.aspx
    http://www.telerik.com/help/openaccess-orm/getting-started-root-migration-tool-use-migration-tool.html

    I added the call to AdjustForDynamicLoad and also added the 'references' section to the config file manually, but that didn't help either.

     

     

     

     

    <connectionStrings>
    <add name="ColonyDB" connectionString="data source=dev-a;initial catalog=ColonyDB;persist security info=True;user id=DB;password=db" providerName="System.Data.SqlClient" />
    <add name="EntityDiagrams" connectionString="data source=dev-a;initial catalog=ColonyDB;persist security info=True;user id=DB;password=db" providerName="System.Data.SqlClient" />
    </connectionStrings>
    <openaccess>
    <references>

    <

     

    reference assemblyname="BusinessObjects" configrequired="True"/>

     

     

    <
    reference assemblyname="EntityDiagrams" configrequired="True"/>
    </references>
    </openaccess>
    </configuration>

    static public Database Database()
    {
        if( theObjectScopeProvider1 == null )
            theObjectScopeProvider1 = new IColonyDB();
      if (theObjectScopeProvider1.myDatabase == null) {
        EntityDiagrams context = new EntityDiagrams();
        MetadataContainer metadata = context.Metadata;
        BackendConfiguration backendConfiguration = EntityDiagrams.GetBackendConfiguration();
        context.Dispose();
        theObjectScopeProvider1.myDatabase = Telerik.OpenAccess.Database.Get("ColonyDB", backendConfiguration, metadata);
      }
      return theObjectScopeProvider1.myDatabase;
    }

    Do you need any more info?

     

  2. Serge
    Admin
    Serge avatar
    375 posts

    Posted 08 Sep 2010 Link to this post

    Hello jon,

    You do not need to add anything in the config files. The OpenAccess section of the config file is now deprecated and should not be added. Let me shed some more information on the topic of upgrading. The new domain model should be used with the new context class that is generated by OpenAcccess. Usually the file that contains the context has the same name as the rlinq file.

    What you are using - the object provider, is only there for backward compatibility and should not be used extensively. If the codebase is not too big I would suggest modifying the code to use the new context instead of the object scope. More info on how to implement the ContextFactory (previously ScopeFactory) you can find in this knowledge base article.

    As to your problem with the voa_keygen, this usually means that at least one of the persistent classes uses the High-Low key generator as identity mechanism. I suggest you to check the identity mechanism for each class in the property pane of Visual Studio and update the value if needed. If you do not have any classes that use the High-Low key generator, the voa_keygen table would not be necessary and the error should disappear. You cal also have a look at this blog post, you should make sure there are no validation errors in the designer prior to running your solution.

    Please contact us back if you are still experiencing problems or face further trouble.

    Regards,
    Serge
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. shivir
    shivir avatar
    4 posts
    Member since:
    Jul 2010

    Posted 04 Feb 2011 Link to this post

    "I suggest you to check the identity mechanism for each class in the property pane of Visual Studio and update the value if needed."

    Referring to your above reply, can you please show me how to do it ?
  5. Petko_I
    Admin
    Petko_I avatar
    184 posts

    Posted 09 Feb 2011 Link to this post

    Hi shivir,

    You can select a metaclass from the entity diagram and press F4. This focuses the property grid definition for the entity. The property grid is usually located below the the solution explorer. There you will find a property called Identity Mechanism. You should change the value depending on the type of identity for the selected entity. You can look at this help topic which elaborates on the different options for the key generators. Although the topic is covered in the classic wizards section, the principles are applicable to the domain model approach as well.

    Do not hesitate to contact us, should  you have further questions.

    Kind regards,
    Petko_I
    the Telerik team
    Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
Back to Top