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

Change Connection String used, not stored in config file

2 Answers 73 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Scott
Top achievements
Rank 2
Scott asked on 11 Jan 2012, 09:08 PM
Our users have the ability to connect to different databases via our WinForm application, thus the connection strings are not stored in the config file. How do we override the connection that gets used by OpenAccess?

2 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 13 Jan 2012, 10:12 AM
Hello Scott,

You can use one of the constructors of the generated context class which has a connection parameter. The value can be either a connection name, pointing to a connection string in the configuration file, or the whole connection string. So all you need to do is get the connection string from the used and pass it to the constructor of the context.
Hope that helps.

Kind regards,
Alexander
the Telerik team

SP1 for Q3’11 of Telerik OpenAccess ORM is available for download

0
Scott
Top achievements
Rank 2
answered on 13 Jan 2012, 02:52 PM
Yes, that worked perfectly. Thanks!
Tags
General Discussions
Asked by
Scott
Top achievements
Rank 2
Answers by
Alexander
Telerik team
Scott
Top achievements
Rank 2
Share this question
or