コード例 #1
0
        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();
                }
            }
        }
コード例 #2
0
 public RavenJObject(IEnumerable <KeyValuePair <string, RavenJToken> > props)
 {
     Properties = new DictionaryWithParentSnapshot();
     foreach (var kv in props)
     {
         Properties.Add(kv);
     }
 }
コード例 #3
0
ファイル: RavenJObject.cs プロジェクト: johannesg/ravendb
 public RavenJObject(RavenJObject other)
 {
     Properties = new DictionaryWithParentSnapshot(other.comparer);
     foreach (var kv in other.Properties)
     {
         Properties.Add(kv);
     }
 }
コード例 #4
0
 public RavenJObject(RavenJObject other, IEqualityComparer <string> comparer)
 {
     Properties = new DictionaryWithParentSnapshot(comparer);
     foreach (var kv in other.Properties)
     {
         Properties.Add(kv);
     }
 }
コード例 #5
0
ファイル: RavenJObject.cs プロジェクト: ravendb/silverlight
		public RavenJObject WithCaseInsensitivePropertyNames()
		{
			var props = new DictionaryWithParentSnapshot(StringComparer.OrdinalIgnoreCase);
			foreach (var property in Properties)
			{
				props[property.Key] = property.Value;
			}
			return new RavenJObject(props);
		}
コード例 #6
0
 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;
     }
 }
コード例 #7
0
 private RavenJObject(DictionaryWithParentSnapshot snapshot)
 {
     Properties = snapshot;
 }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RavenJObject"/> class.
 /// </summary>
 public RavenJObject()
 {
     Properties = new DictionaryWithParentSnapshot();
 }
コード例 #9
0
ファイル: RavenJObject.cs プロジェクト: johannesg/ravendb
 public RavenJObject(IEqualityComparer <string> comparer)
 {
     this.comparer = comparer;
     Properties    = new DictionaryWithParentSnapshot(comparer);
 }
コード例 #10
0
 private DictionaryWithParentSnapshot(DictionaryWithParentSnapshot previous)
 {
     LocalChanges   = new Dictionary <string, RavenJToken>();
     parentSnapshot = previous;
 }
コード例 #11
0
 private DictionaryWithParentSnapshot(DictionaryWithParentSnapshot previous)
 {
     comparer       = previous.comparer;
     parentSnapshot = previous;
 }