/// <summary> /// Sets value to settings table /// </summary> /// <param name="name"></param> /// <param name="value"></param> public static void Set(string name, object value) { // Structures and IClonable classes can only be added and automatically cloned to the settings table // Any other types added to settings table will not be multiplied during new setting creation var ht = (SettingsKeys.Contains(name)) ? Default.ActiveTable : Default.DataTable; ht[name] = value; }
/// <summary> /// Set object by key /// </summary> /// <typeparam name="T"></typeparam> /// <param name="name"></param> /// <param name="default"></param> /// <returns></returns> public static T Get <T>(string name, T @default) { var ht = (SettingsKeys.Contains(name)) ? Default.ActiveTable : Default.DataTable; if (!ht.Contains(name)) { ht[name] = @default; } return((T)ht[name]); }
/// <summary> /// Determines whether this instance is injectable the specified setting. /// </summary> /// <returns><c>true</c> if this instance is injectable the specified setting; otherwise, <c>false</c>.</returns> /// <param name="setting">Setting.</param> private bool IsInjectable(KeyValuePair <string, object> setting) { bool isUnsafe = SettingsKeys.Contains(setting.Key) || setting.Key.EndsWith(OverrideSuffix); return(!isUnsafe || this.InjectOwnSettings); }