什么是动态负载连接字符串的最佳方式 [英] What is the best way to dynamic load connection strings

查看:95
本文介绍了什么是动态负载连接字符串的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了这个问题在其他一些职位,但想到我会问qustion对我的问题的说明。

I've seen some other posts in this topic, but thought I would ask the qustion with a description on my problem.

我有一个登录页面至极使用SQL提供商用户登录。然后,用户应重定向到主应用程序。这是一个基于Web的CRM应用至极,我们有muliple客户。

I have a login page wich uses SQL provider for the user login. Then the user should be redirected to the main application. This is a web based CRM application wich we have muliple clients.

我的目标是使用一个单一的网站,但多个SQL数据库。这SIGNES在用户应使用coresponds他所属公司的连接字符串。

My goal is to use a single web site, but multiple SQL databases. And the user that signes in should use a connection string that coresponds to the company he belongs.

什么好的想法?

推荐答案

将它的工作创建用户的组织和相应的数据库连接之间的简单地图吗?

Would it work to create a simple map between the user's organization and the appropriate database connection?

这可能是作为一个词典&LT一样简单;字符串,字符串> 在Global.asax中初始化。关键将是该公司在web.config中定义的连接字符串的名称。

It could be as simple as a Dictionary<string, string> initialized in global.asax. The key would be the company and the name of a connection string defined in web.config.

如果您需要进行此配置,您可以自定义配置节加载这样的字典中的值。

If you need to make this configurable, you can load the values for such a dictionary from a custom configuration section.

这篇关于什么是动态负载连接字符串的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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