public int UpdateSystemSetting(SystemSetting data) { var needRestartHistory = false; if (data.ChangedProperties.Any(m => m.Key == "HistoryPath")) { //历史保存路径修改了 needRestartHistory = true; //这里确保能创建数据库 if (!string.IsNullOrEmpty(data.HistoryPath)) { var HistoryDataPath = $"data source=\"{data.HistoryPath.Replace("\\", "/")}/history_data.db\""; using (var hisDB = new DB.SunRiz(HistoryDataPath, Way.EntityDB.DatabaseType.Sqlite)) { } } } if (data.ChangedProperties.Any(m => m.Key == "LogPath")) { SystemLog.Init(); } SystemHelper.AddSysLog(this.User.id.Value, "更新系统设置:" + Newtonsoft.Json.JsonConvert.SerializeObject(data.ChangedProperties)); this.db.Update(data); if (needRestartHistory) { HistoryRecord.HistoryAutoRec.ReStart(); } return(data.id.Value); }