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

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

6 Answers 122 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gunnar Skogen
Top achievements
Rank 1
Gunnar Skogen asked on 27 Oct 2009, 10:06 AM
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

6 Answers, 1 is accepted

Sort by
0
IT-Als
Top achievements
Rank 1
answered on 27 Oct 2009, 05:29 PM
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
0
Gunnar Skogen
Top achievements
Rank 1
answered on 28 Oct 2009, 07:42 AM
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
0
IT-Als
Top achievements
Rank 1
answered on 28 Oct 2009, 07:49 AM
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
0
Gunnar Skogen
Top achievements
Rank 1
answered on 28 Oct 2009, 08:25 AM
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
0
IT-Als
Top achievements
Rank 1
answered on 28 Oct 2009, 08:33 AM
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



0
Ady
Telerik team
answered on 30 Oct 2009, 02:59 PM
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.
Tags
Development (API, general questions)
Asked by
Gunnar Skogen
Top achievements
Rank 1
Answers by
IT-Als
Top achievements
Rank 1
Gunnar Skogen
Top achievements
Rank 1
Ady
Telerik team
Share this question
or