コード例 #1
0
ファイル: ConflictsResolver.cs プロジェクト: xinix00/ravendb
        private void HandleSimpleValues(Dictionary <string, object> result, KeyValuePair <string, RavenJToken> prop, int index)
        {
            var conflicted = new Conflicted
            {
                Values = { prop.Value }
            };

            for (var i = 0; i < docs.Length; i++)
            {
                if (i == index)
                {
                    continue;
                }
                var other = docs[i];

                RavenJToken otherVal;
                if (other.TryGetValue(prop.Key, out otherVal) == false)
                {
                    continue;
                }
                if (RavenJTokenEqualityComparer.Default.Equals(prop.Value, otherVal) == false)
                {
                    conflicted.Values.Add(otherVal);
                }
            }

            if (conflicted.Values.Count == 1)
            {
                result.Add(prop.Key, prop.Value);
            }
            else
            {
                result.Add(prop.Key, conflicted);
            }
        }
コード例 #2
0
        private void HandleSimpleValues(Dictionary <string, object> result, BlittableJsonReaderObject.PropertyDetails prop, int index)
        {
            var conflicted = new Conflicted
            {
                Values = { prop }
            };

            for (var i = 0; i < _docs.Length; i++)
            {
                if (i == index)
                {
                    continue;
                }
                var other = _docs[i];
                if (other == null)
                {
                    continue;
                }

                BlittableJsonReaderObject.PropertyDetails otherProp = new BlittableJsonReaderObject.PropertyDetails();
                var propIndex = other.GetPropertyIndex(prop.Name);
                if (propIndex == -1)
                {
                    continue;
                }
                other.GetPropertyByIndex(propIndex, ref otherProp);

                if (otherProp.Token != prop.Token ||// if type is null there could not be a conflict
                    (prop.Value?.Equals(otherProp.Value) == false)
                    )
                {
                    conflicted.Values.Add(otherProp);
                }
            }

            if (conflicted.Values.Count == 1)
            {
                result.Add(prop.Name, prop);
            }
            else
            {
                result.Add(prop.Name, conflicted);
            }
        }
コード例 #3
0
ファイル: ConflictsResolver.cs プロジェクト: j2jensen/ravendb
        private void HandleSimpleValues(Dictionary<string, object> result, KeyValuePair<string, RavenJToken> prop, int index)
        {
            var conflicted = new Conflicted
            {
                Values = { prop.Value }
            };

            for (var i = 0; i < docs.Length; i++)
            {
                if (i == index)
                    continue;
                var other = docs[i];

                RavenJToken otherVal;
                if (other.TryGetValue(prop.Key, out otherVal) == false)
                    continue;
                if (RavenJTokenEqualityComparer.Default.Equals(prop.Value, otherVal) == false)
                    conflicted.Values.Add(otherVal);
            }

            if (conflicted.Values.Count == 1)
                result.Add(prop.Key, prop.Value);
            else
                result.Add(prop.Key, conflicted);
        }