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
精彩评论