VS: How to use OpenAccess class library in Service/Console App

7 posts, 0 answers
  1. Gunnar Skogen
    Gunnar Skogen avatar
    10 posts
    Member since:
    Jul 2009

    Posted 27 Oct 2009 Link to this post

    Hi,

    In VS 2008 I have a Solution with a Telerik OpenAccess class library project and a Web project using this for data access (via a database handler class in the same library) - this works fine.

    How can this Solution have a Service project that uses the OpenAccess class library project for data access same way the Web project does?  This is probably more of a VS configuration question - just referencing the OpenAccess class library project does not work..


    Thanks
  2. TSE
    TSE avatar
    381 posts
    Member since:
    Sep 2008

    Posted 27 Oct 2009 Link to this post

    Hi Gunnar,

    This is most probably as you said a configuration issue.

    Have you tried running the Configuration Check from the OpenAccess menu item within VS? It should give you details if any configuration settings are missing.
    However, the project that uses/manipulates/retrieves/stores the persistent classes should have config informartion.

    Sorry, I can't be more specific for the info you gave in your thread..

    Regards

    Henrik
  3. DevCraft banner
  4. Gunnar Skogen
    Gunnar Skogen avatar
    10 posts
    Member since:
    Jul 2009

    Posted 28 Oct 2009 Link to this post

    Hi Henrik,

    Thanks, just did: It checks out ok (as expected since it works with the Web Project).
    Thing is for the Service project to use the OpenAccess class library in a similar way as the web project does.
    I have referenced the class library dll and the Telerik.OpenAccess.Query.dll, but the web project references the data access through an xml file in addition to these through its bin directory: Telerik.OpenAccess.Query.xml.

    Beeing relative new to VS I have not really delved deep into project configuration but it seems logical that you need some special "glue" for a Project to use a class library's configuration like the Web project does.

    Thanks
  5. TSE
    TSE avatar
    381 posts
    Member since:
    Sep 2008

    Posted 28 Oct 2009 Link to this post

    Hi Gunnar,

    I need some more info:
    What error are you seeing.. is this a build error or a runtime error.

    Try to reference the Telerik.OpenAccess dll instead of the Telerik.OpenAccess.Query dll.

    Did you run "Enable project" on the service project?

    Regards

    Henrik
  6. Gunnar Skogen
    Gunnar Skogen avatar
    10 posts
    Member since:
    Jul 2009

    Posted 28 Oct 2009 Link to this post

    Hi Henrik,

    It is a runtime error: An {"The 'openaccess' section cannot be found in the application's configuration file."} Exception occors when I get the scope in this line:

    theObjectScopeProvider1.myDatabase = Telerik.OpenAccess.

    Database.Get( "DatabaseConnection1" );

     

    (which it wont find in the Service Project as it is in the OpenAccess class library

    Enable project: I assume you you mean Enable OpenAccess:
    Thought that would mean mapping the db again, but unchecking the "Persistent classes" and "Data Access Code" did the neccessary magic -only needed to set the <connection> in App.config right and I got the scope.

    Thanks a lot!

    Seems like a case of me not reading doc/ browsing enough, but hopefully this will be helpful to others in haste.

    Best Regards


    Gunnar
  7. TSE
    TSE avatar
    381 posts
    Member since:
    Sep 2008

    Posted 28 Oct 2009 Link to this post

    Hi Gunnar,

    Glad I could help and hope you will like OpenAccess as much as my team did. We have been working with this product for 4+ years and have not encountered any performance issues yet. I usually answer performance question this way (and I know a LOT of people does not share this view" - been into several discussions on this)

    Mr. X: "So, how's performance?"
    Me: "Who cares, as long as it performs good enough for what I want to achieve"

    The key is of cause to know what "good enough" is, but that's another story :-)

    Regards

    Henrik



  8. Ady
    Admin
    Ady avatar
    589 posts

    Posted 30 Oct 2009 Link to this post

    Hi  ,

     @Henrik - Thanks for the kind words.

    @Gunnar - The <reference> entry added by the wizard helps OpenAccess to find it's way to the right configuration section. Do feel free to get back to us in case you need further assistance with the product. We would be glad to assist.

    Sincerely yours,
    Ady
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
DevCraft banner