集中式数据库连接字符串商 [英] Centralised database connection string provider

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

问题描述

我要建一个访问各种数据库的应用程序。 目前,连接字符串存储在app.config文件。 不过,我希望能够更轻松地配置数据库的连接字符串。

I'm building an application that accesses various databases. Currently the connection strings are stored in the App.Config file. However I'd like to be able to configure the connection strings for the database more easily.

我考虑有一个包含所有其他数据库的连接字符串一个主数据库。这意味着每个需要一个数据库连接的应用程序将查找从主数据库的连接。

I'm considering having a single "master" database that contains the connection strings for all the other databases. This would mean that each application that requires a database connection would lookup the connection from the master database.

app.config文件可以存储在表名的数据库连接字符串。这将允许应用程序的多个实例使用相同的主数据库有不同的表用于查找连接字符串。

The App.config file could store the table name for the database connection strings. This would allow for multiple instances of the application to use the same "master" database with a different table for looking up the connection strings.

有什么优势/这种方法的缺点是什么?

What are the advantages/disadvantages of this approach?

有没有人做过类似的事情?

Has anyone done something similar?

这被认为是最好的做法?

Is this considered a best practice?

推荐答案

如果你正在寻找一个集中的配置服务,那么不要再观望了的 StockTrader.Net 示例应用程序,其中包括与源一个​​完整的配置服务。

If you are looking for a centralised configuration service then look no further that the StockTrader.Net sample app which includes a complete config service with source.

这篇关于集中式数据库连接字符串商的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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