Question

I am using Team foundation server and I have a problem with the Database. What connection string should I use? I have my connection string on my computer but it's different for every computer.

Was it helpful?

Solution

You can solve this problem in a number of ways. I'm assuming here that your connection string is currently in a standard app.config or web.config file. Also, this list is almost certainly not exhaustive...

  • The simplest (but ugliest) is for each user to check out the config file and put their own connection string in locally. This works, but you will get unnecessary changes checked in to the config file.

  • If your developers are all using local instances of SQL and the database name is the same on each machine, you can simply use localhost or 127.0.0.1 in your connection string to point at the local machine. This will work on all machines as long as the database name is consistent.

  • You can move the connection string out of the config file, into a separate file or location that is not checked into TFS. For example, you could check for a userOverrides.config file (that you never check in), or pull the connection string from the registry instead. You could still use the core configuration file to provide a default value, but nobody would need to edit it for day-to-day work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top