开发者

Managing connectionstrings for multiple projects in same solution

Currently I have a larger Solution wit开发者_StackOverflow社区h different projects (A web application and a windows service,...). Since both applications use the same database, I created a connectionstrings.config file which is included by the web.confg (or app.config) using the connectsionstring's configsource attribute.

To maintain only one file, I did the following:

  • One project contains the "real" connectionstrings file
  • For all other projects that require the connectionstrings, I have added the existing connectionstrings.config file using the "add as link" option within Visual Studio.

To support different connectionstrings for different environments, I created environment folders that contain their own connectionstrings file. These files are used to replace the default ones during the buildprocess.

I wanted to know if you have other solutions for configuration values within different environments/projects?


If you are using Visual Studio 2010, you can use the config transform (video) feature.

See this blog post for details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜