private void OnDiff(CacheSysProfileMode item, CacheSysProfileMode diff) { item.Id = ObjectId.Empty; if (IsUpdate && !CheckOnly) { var copy = MongoDBHelper.FromJson <CacheSysProfileMode>(item.ToJson()); if (copy.ValueType == diff.ValueType) { copy.ItemValue = diff.ItemValue; } copy.Id = diff.Id; mongo.ReplaceOne(e => e.Id == diff.Id, copy); } if (IsUpdate || !HasDBAction) { var key = item.Mode + ':' + item.Item; var parent = Tree["更新"]; AddTreeNode(key, new { 原 = diff, 新 = item }, parent).IsExpanded = true; } }
private List <CacheSysProfileMode> ReadMongoJson(string json) { var result = MongoDBHelper.FromManyJson <CacheSysProfileMode>(json); return(result); }