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

Connection strings in separate file

1 Answer 108 Views
Feature Requests
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andrew
Top achievements
Rank 1
Andrew asked on 19 Oct 2009, 11:55 PM
Hi,

This is a "small" issue, but worth while dealing with.

One problem with development and then later deployment to a test system and finally to production, is that the database connection strings will (may) be different in each case.

In my projects, I have got into the habit of using a separate file to hold connection strings, and refer to that file using the "configSource" directive.

So for example in my web.config instead of a <conenctionStrings section with all the strings embdeded I simply code the following:
  <connectionStrings configSource="connection.config" /> 
 
Then I create a separate file called connection.config which holds the actual connection data.
<connectionStrings> 
  <remove name="LocalSqlServer" /> 
  <add name="XXXConnection" connectionString="Data Source=SERVERNAME;Initial Catalog=DATABASENAME;Integrated Security=True" providerName="System.Data.SqlClient" /> 
</connectionStrings> 
 
Then when I deploy to different environments, I don't deploy the "development" conneciiton.config file instead the file of that name in each environment already has the correct values for that environment.

I use the same "trick" with OA, in the section <openaccess>, I replace the <connections> ..... </connections> with:

    <connections configSource="connectionOA.config" /> 
 
 and put my actual connection data into the file "connectionOA.config" as follows:
<openaccess xmlns="http://www.telerik.com/OpenAccess">  
  <connections configSource="connectionOA.config">  
    <connection id="MADConnection">  
      <databasename>MAD_Live</databasename> 
      <servername>Andy-i7-PC\ENTERPRISE2008</servername> 
      <integratedSecurity>True</integratedSecurity> 
      <backendconfigurationname>mssqlMADConfiguration</backendconfigurationname> 
    </connection> 
  </connections> 
</openaccess> 
 
am not sure why I have to repeat the <openaccess ...> tags, whether they are there or not it all works, but visual studio does compain without them.

FIrstly it would be nice if you could arrange that the connection data was the same as for the rest of the project (i.e. connectionStrings her than connections). That way I only need the one file of connection info.

Secondly, if I run the Open Access -> Configuration -> Check Settings it complains saying

Validator :

 

<connections> section

 

Description :

 

'Connections' node not present in config file.

 


Which is of course not true since there is a <connections> section - it is just not as the checker expects. So it woudl be nice if this were to run cleanly (not a major issue, but tidyness is a good thing).

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar Kapitanov
Telerik team
answered on 22 Oct 2009, 07:43 AM
Hello Andrew,
We will be introducing a way to handle the native ado.net connection strings in the natural for .net way with Telerik OpenAccess ORM, starting with Q3. I am not that all 100% functionality will be there (in terms of UI and validations) but you will be able to work the way you think it is natural with connection strings, including 'in-code' API will be available.

Sincerely yours,
Dimitar Kapitanov
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
Feature Requests
Asked by
Andrew
Top achievements
Rank 1
Answers by
Dimitar Kapitanov
Telerik team
Share this question
or