private static void FillDifferentJsonData(DictionaryWithParentSnapshot selfObj, DictionaryWithParentSnapshot otherObj, Dictionary <string, string> diffData) { Debug.Assert(diffData != null, "Precaution --> parameter should not be null"); string[] diffNames; DictionaryWithParentSnapshot bigObj; if (selfObj.Keys.Count < otherObj.Keys.Count) { diffNames = otherObj.Keys.Except(selfObj.Keys).ToArray(); bigObj = otherObj; } else { diffNames = selfObj.Keys.Except(otherObj.Keys).ToArray(); bigObj = selfObj; } foreach (var kvp in diffNames) { RavenJToken token; if (bigObj.TryGetValue(kvp, out token)) { diffData[kvp] = token.ToString(); } } }
public RavenJObject(IEnumerable <KeyValuePair <string, RavenJToken> > props) { Properties = new DictionaryWithParentSnapshot(); foreach (var kv in props) { Properties.Add(kv); } }
public RavenJObject(RavenJObject other) { Properties = new DictionaryWithParentSnapshot(other.comparer); foreach (var kv in other.Properties) { Properties.Add(kv); } }
public RavenJObject(RavenJObject other, IEqualityComparer <string> comparer) { Properties = new DictionaryWithParentSnapshot(comparer); foreach (var kv in other.Properties) { Properties.Add(kv); } }
public RavenJObject WithCaseInsensitivePropertyNames() { var props = new DictionaryWithParentSnapshot(StringComparer.OrdinalIgnoreCase); foreach (var property in Properties) { props[property.Key] = property.Value; } return new RavenJObject(props); }
private DictionaryWithParentSnapshot(DictionaryWithParentSnapshot previous) { comparer = previous.comparer; if (previous.parentSnapshot != null) { if(previous.localChanges != null) localChanges = new Dictionary<string, RavenJToken>(previous.localChanges, comparer); parentSnapshot = previous.parentSnapshot; } else { parentSnapshot = previous; } }
private RavenJObject(DictionaryWithParentSnapshot snapshot) { Properties = snapshot; }
/// <summary> /// Initializes a new instance of the <see cref="RavenJObject"/> class. /// </summary> public RavenJObject() { Properties = new DictionaryWithParentSnapshot(); }
public RavenJObject(IEqualityComparer <string> comparer) { this.comparer = comparer; Properties = new DictionaryWithParentSnapshot(comparer); }
private DictionaryWithParentSnapshot(DictionaryWithParentSnapshot previous) { LocalChanges = new Dictionary <string, RavenJToken>(); parentSnapshot = previous; }
private DictionaryWithParentSnapshot(DictionaryWithParentSnapshot previous) { comparer = previous.comparer; parentSnapshot = previous; }