How to create a broad connect solution string

Does anyone know if it is possible to create a single connection string that will be available for all projects in the solution (we have about 6).

I can create a text file with this information, but we also need development-time support, and it makes no sense to have a connection string in every App.Config and Web.config file in the solution.

Basically, we want the single connection string to be easily changed if the db change location, which the IDE will also use to support development time

+6
visual-studio global connection-string solution app-config
source share
2 answers

Not sure if you can just put the new configuration file in the solution elements and enable and load it in all projects?

Edit: I'm specifically talking about a generic configuration file (XML), not about "App.config". It has exactly the same format, it's just a different name. Add this file to your solution elements and access it using OpenMappedExeConfiguration . You can find an additional example here .

+2
source share

enter the connection string into the configuration of your "main" project. Create a data access project with the connectionstring property. Set this property when you initialize the project and use the Data Access project for all database related activities in all 6 projects.

+1
source share

All Articles