-
-
Save SharePointX/7982ec3e66e2b118c0bce5d097838512 to your computer and use it in GitHub Desktop.
Updating config value from the db at application initialization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); | |
IDictionary<string, string> staticAppSettings = ConfigService.GetStaticAppSettings(); | |
foreach (var setting in staticAppSettings) | |
{ | |
if (ConfigurationManager.AppSettings[setting.Key] == null) | |
config.AppSettings.Settings.Add(setting.Key, setting.Value); | |
else | |
ConfigurationManager.AppSettings[setting.Key] = setting.Value; | |
} | |
config.Save(); | |
ConfigurationManager.RefreshSection("appSettings"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment