public void AddSetting(string name, string value) { var setting = new Setting { SettingId = Guid.NewGuid(), Name = name, Value = value }; Context.AddToSettings(setting); Context.SaveChanges(); RefreshCache(); }
/// <summary> /// Deprecated Method for adding a new object to the Settings EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSettings(Setting setting) { base.AddObject("Settings", setting); }
/// <summary> /// Create a new Setting object. /// </summary> /// <param name="settingId">Initial value of the SettingId property.</param> /// <param name="name">Initial value of the Name property.</param> public static Setting CreateSetting(global::System.Guid settingId, global::System.String name) { Setting setting = new Setting(); setting.SettingId = settingId; setting.Name = name; return setting; }
private BannerLogoManager() { _logoSetting = loadLogoSettings(); CurrentLogoPath = _logoSetting.Value; }
public void Save(Setting setting) { if (setting == null) throw new ArgumentNullException("setting"); if (setting.SettingId == Guid.Empty || Context.Settings.Where(s => s.SettingId == setting.SettingId).FirstOrDefault() == null) { if (setting.SettingId == Guid.Empty) setting.SettingId = Guid.NewGuid(); Context.AddToSettings(setting); } Context.SaveChanges(); RefreshCache(); }