In my case, although I use L2S instead of L2E, a recommendation should be made. I have a generic Config library that feeds from an XML file. When a data context is needed, each data object has a method such as the following. Of course, if you want, you can easily mask the template.
private static string _conStr = null; private static CalendarsAndListsDataContext GetDataContext() { if (_conStr == null) { _conStr = ConfigurationLibrary.Config.Settings().GetConnectionString("liveConString"); } return new CalendarsAndListsDataContext(_conStr); }
Now the biggest drawback is the connection string changes that require the application to restart, but in my case this is not a problem.
Serapth
source share