开发者

Substitute ConnectionString for some users on asp.net Web Site

开发者 https://www.devze.com 2023-03-12 01:01 出处:网络
I modify asp.net Web Site. I need use different connection strings for users. Web Site use Entity Framework for data access.

I modify asp.net Web Site. I need use different connection strings for users. Web Site use Entity Framework for data access.

How can I substitute settings in runtime? I can instantiate with specified ConnectionString, but it will require multiple changes, because used default constructor everywhere.

I find s开发者_高级运维olution for projects - using partial class for Settings. But Settings no in Web Site (I mistake maybe?).


You can simply load a new connect string from either your web.config, database, or whereever you use it and assign it to your context object when you create it. See: http://social.msdn.microsoft.com/Forums/en/adodotnetentityframework/thread/2efc32f7-23ad-4fad-84cf-279badb394a5

0

精彩评论

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