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

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

问题描述

我的解决方案中目前有三个项目,它们都有自己的 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 中,如图所示 这里
  3. 将配置设置存储在注册表中

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

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

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

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