Esempio n. 1
0
#pragma warning disable CA1720 // Identifier contains type name
        /// <summary>
        /// Initializes a new instance of the <see cref="ObjectRepositoryPropertyValue"/> class.
        /// </summary>
        /// <param name="object">The object.</param>
        /// <param name="property">The property.</param>
        /// <param name="value">The value.</param>
        public ObjectRepositoryPropertyValue(IModelObject @object, ModifiablePropertyInfo property, object value = null)
#pragma warning restore CA1720 // Identifier contains type name
        {
            Object   = @object ?? throw new ArgumentNullException(nameof(@object));
            Property = property ?? throw new ArgumentNullException(nameof(property));
            Value    = value;
        }
        /// <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;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MetadataTreeMergeChunkChange"/> class.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="mergeBaseNode">The merge base node.</param>
        /// <param name="branchNode">The branch node.</param>
        /// <param name="headNode">The head node.</param>
        /// <param name="property">The property.</param>
        /// <param name="mergeBaseValue">The merge base value.</param>
        /// <param name="branchValue">The branch value.</param>
        /// <param name="headValue">The head value.</param>
        /// <exception cref="ArgumentNullException">
        /// path
        /// or
        /// mergeBaseNode
        /// or
        /// branchNode
        /// or
        /// headNode
        /// or
        /// property
        /// or
        /// value
        /// </exception>
        public MetadataTreeMergeChunkChange(string path, JObject mergeBaseNode, JObject branchNode, JObject headNode, ModifiablePropertyInfo property, JToken mergeBaseValue, JToken branchValue, JToken headValue)
        {
            Path           = path ?? throw new ArgumentNullException(nameof(path));
            MergeBaseNode  = mergeBaseNode ?? throw new ArgumentNullException(nameof(mergeBaseNode));
            BranchNode     = branchNode ?? throw new ArgumentNullException(nameof(branchNode));
            HeadNode       = headNode ?? throw new ArgumentNullException(nameof(headNode));
            Property       = property ?? throw new ArgumentNullException(nameof(property));
            MergeBaseValue = mergeBaseValue ?? throw new ArgumentNullException(nameof(mergeBaseValue));
            BranchValue    = branchValue ?? throw new ArgumentNullException(nameof(branchValue));
            HeadValue      = headValue ?? throw new ArgumentNullException(nameof(headValue));

            if (!IsInConflict)
            {
                MergeValue = BranchValue;
            }
        }