コード例 #1
0
        /// <summary>
        /// Gets whether the given <paramref name="chunk"/> <see cref="Value"/> is equal to the current value.
        /// </summary>
        /// <param name="chunk">The chunk to compare to.</param>
        /// <returns><code>true</code> if chunks have same value. <code>false</code> otherwise.</returns>
        public bool HasSameValue(ObjectRepositoryPropertyValue chunk)
        {
            if (chunk == null)
            {
                throw new ArgumentNullException(nameof(chunk));
            }

            return(EqualityComparer <object> .Default.Equals(Value, chunk.Value));
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ObjectRepositoryPropertyChange"/> class.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="property">The property.</param>
        /// <param name="ancestor">The ancestor.</param>
        /// <param name="theirs">Their node.</param>
        /// <param name="ours">Our node.</param>
        public ObjectRepositoryPropertyChange(string path, ModifiablePropertyInfo property, ObjectRepositoryPropertyValue ancestor, ObjectRepositoryPropertyValue theirs, ObjectRepositoryPropertyValue ours)
        {
            Path          = path ?? throw new ArgumentNullException(nameof(path));
            Property      = property ?? throw new ArgumentNullException(nameof(property));
            Ancestor      = ancestor ?? throw new ArgumentNullException(nameof(ancestor));
            Theirs        = theirs ?? throw new ArgumentNullException(nameof(theirs));
            Ours          = ours ?? throw new ArgumentNullException(nameof(ours));
            WasInConflict = !ancestor.HasSameValue(ours) && !theirs.HasSameValue(ours);

            Id = ancestor.Object.Id;

            if (!IsInConflict)
            {
                MergeValue = Theirs.Value;
            }
        }