/// <summary> /// Save settings to a file /// </summary> /// <param name="settings"></param> public virtual void SaveSettings(DataSettings settings) { if (settings == null) { throw new ArgumentNullException("settings"); } Singleton <DataSettings> .Instance = settings; string filePath = Path.Combine(CommonHelper.MapPath("~/App_Data/"), filename); if (!File.Exists(filePath)) { using (File.Create(filePath)) { //we use 'using' to close the file after it's created } } var text = ComposeSettings(settings); File.WriteAllText(filePath, text); }
/// <summary> /// Ctor /// </summary> /// <param name="settings">Data settings</param> protected BaseDataProviderManager(DataSettings settings) { if (settings == null) throw new ArgumentNullException("settings"); this.Settings = settings; }