Ejemplo n.º 1
0
        public void CopyConfigToAppSettings(IWebConfigWriter webConfigWriter)
        {
            if (webConfigWriter == null)
            {
                throw new ArgumentNullException(nameof(webConfigWriter), "The web config writer is required");
            }

            foreach (KeyValuePair <string, string> pair in _webConfigReader.GetAppSettings())
            {
                var updatedValue = _config.GetValue <string>(pair.Key);
                if (updatedValue != null)
                {
                    webConfigWriter.SetAppSetting(pair.Key, updatedValue);
                }
            }
        }
        public void CopyExternalAppSettings(IWebConfigWriter webConfigWriter)
        {
            if (webConfigWriter == null)
            {
                throw new ArgumentNullException(nameof(webConfigWriter), "WebConfig writer is required");
            }

            foreach (var appSetting in _webConfigReader.GetAppSettings())
            {
                var value = _config[$"appSettings:{appSetting.Key}"];

                if (!string.IsNullOrEmpty(value))
                {
                    webConfigWriter.SetAppSetting(appSetting.Key, value);
                }
            }
        }