/// <summary> /// Adds values from a PropertySource to the Configurtation Data dictionary managed /// by this provider /// </summary> /// <param name="source">a property source to add</param> protected internal virtual void AddPropertySource(PropertySource source) { if (source == null || source.Source == null) { return; } foreach (KeyValuePair <string, object> kvp in source.Source) { try { string key = ConvertKey(kvp.Key); string value = ConvertValue(kvp.Value); Data[key] = value; } catch (Exception e) { _logger?.LogError("Config Server exception, property: {0}={1}", kvp.Key, kvp.Value.GetType(), e); } } }
/// <summary> /// Adds values from a PropertySource to the provided dictionary. /// </summary> /// <param name="source">a property source to add</param> /// <param name="data">the dictionary to add the property source to</param> protected internal void AddPropertySource(PropertySource source, IDictionary <string, string> data) { if (source == null || source.Source == null) { return; } foreach (var kvp in source.Source) { try { var key = ConvertKey(kvp.Key); var value = ConvertValue(kvp.Value); data[key] = value; } catch (Exception e) { _logger?.LogError("Config Server exception, property: {0}={1}", kvp.Key, kvp.Value.GetType(), e); } } }
/// <summary> /// Adds values from a PropertySource to the Configurtation Data dictionary managed /// by this provider /// </summary> /// <param name="source">a property source to add</param> internal protected virtual void AddPropertySource(PropertySource source) { if (source == null || source.Source == null) { return; } foreach (KeyValuePair <string, object> kvp in source.Source) { try { string key = kvp.Key.Replace(".", ConfigurationPath.KeyDelimiter); string value = kvp.Value.ToString(); Data[key] = value; } catch (Exception e) { _logger?.LogError("Config Server exception, property: {0}={1}", kvp.Key, kvp.Value.GetType(), e); } } }
protected internal virtual void AddPropertySource(PropertySource source) { AddPropertySource(source, Data); }