集中同一解决方案中多个项目的连接字符串 [英] Centralize connection strings for multiple projects within the same solution

查看:64
本文介绍了集中同一解决方案中多个项目的连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在解决方案中有三个项目,它们都有各自的App.config文件,并且具有相同的确切连接字符串.

I currently have three projects in my solution that all have their own App.config file with the same exact connection string.

有没有一种方法可以合并连接字符串/app.config文件,这样我只需要对一个位置进行更改?

Is there a way to consolidate the connections strings / app.config files so that I only need to make changes to one location?

推荐答案

有几种方法可以实现:

  1. 此处所示,在machine.config中放入常用配置设置.
  2. 将通用配置设置放入中央文件中,并链接到每个项目的app.config中,如
  1. Put common configuration settings in machine.config as shown here
  2. Put common configuration settings in a central file and link to that in each projects's app.config as shown here
  3. Store the configuration settings in the registry

对我来说,我总是使用最后的解决方案:) 祝你好运!

For me, i always work with the last solution :) Good luck!

这篇关于集中同一解决方案中多个项目的连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆