I need to be able to change the location of the database at runtime through a menu in my program. My question is how to best achieve this.
If for example the ip to the server change, the user need to be able to update the database path; i.e. change a part of the connectionString.
This would be easy to achieve hardcoding the connectionString into the code but I'm not sure if that is the right thing to do since it contains a user and password.
Currently I'm storing the connectionString into an app.config file that I've encrypted. Is there a way to change only the location of the database in this file?
I could of course remove the connectionString from the .config file replacing it with an updated one at runtime but then again I would need to write the user and password into the code.
Or should I use Integrated Security instead and write the connectionString into the code instead of the .config file.
Im using Linq to Sql with a MSSql database.