/// <summary>
        /// Returns whether or not the given annotation is equal to the current annotation
        /// </summary>
        /// <param name="other">The annotation to compare to</param>
        /// <returns>True if the annotations are equivalent, false otherwise</returns>
        public override bool Equals(ODataPayloadElementEquatableAnnotation other)
        {
            ExceptionUtilities.CheckObjectNotNull(this.ValueEqualityFunc, "Value equality callback must not be null");
            return(this.CastAndCheckEquality <XmlTreeAnnotation>(
                       other,
                       tree =>
            {
                if (this.IsAttribute != tree.IsAttribute)
                {
                    return false;
                }

                if (this.LocalName != tree.LocalName)
                {
                    return false;
                }

                if (this.NamespaceName != tree.NamespaceName)
                {
                    return false;
                }

                if (this.NamespacePrefix != tree.NamespacePrefix)
                {
                    return false;
                }

                if (!this.ValueEqualityFunc(this.PropertyValue, tree.PropertyValue))
                {
                    return false;
                }

                if (this.Children.Count != tree.Children.Count)
                {
                    return false;
                }

                var remainingChildren = tree.Children.ToList();
                foreach (var child in this.Children)
                {
                    var match = remainingChildren.FirstOrDefault(c => child.Equals(c));
                    if (match == null)
                    {
                        return false;
                    }

                    remainingChildren.Remove(match);
                }

                return true;
            }));
        }
 /// <summary>
 /// Returns whether or not the given annotation is equal to the current annotation
 /// </summary>
 /// <param name="other">The annotation to compare to</param>
 /// <returns>True if the annotations are equivalent, false otherwise</returns>
 public override bool Equals(ODataPayloadElementEquatableAnnotation other)
 {
     return(this.CastAndCheckEquality <SelfLinkAnnotation>(other, o => o.Value == this.Value));
 }
 /// <summary>
 /// Returns whether or not the given annotation is equal to the current annotation
 /// </summary>
 /// <param name="other">The annotation to compare to</param>
 /// <returns>True if the annotations are equivalent, false otherwise</returns>
 public override bool Equals(ODataPayloadElementEquatableAnnotation other)
 {
     return(this.CastAndCheckEquality <CollectionNameAnnotation>(other, o => o.Name == this.Name));
 }
Exemple #4
0
 /// <summary>
 /// Returns whether or not the given annotation is equal to the current annotation
 /// </summary>
 /// <param name="other">The annotation to compare to</param>
 /// <returns>True if the annotations are equivalent, false otherwise</returns>
 public override bool Equals(ODataPayloadElementEquatableAnnotation other)
 {
     return(this.CastAndCheckEquality <FunctionAnnotation>(other, o => o.Function == this.Function && o.FunctionImport == this.FunctionImport));
 }
 /// <summary>
 /// Returns whether or not the given annotation is equal to the current annotation
 /// </summary>
 /// <param name="other">The annotation to compare to</param>
 /// <returns>True if the annotations are equivalent, false otherwise</returns>
 public override bool Equals(ODataPayloadElementEquatableAnnotation other)
 {
     return(this.CastAndCheckEquality <MemberPropertyAnnotation>(other, o => o.Property == this.Property));
 }
 /// <summary>
 /// Returns whether or not the given annotation is equal to the current annotation
 /// </summary>
 /// <param name="other">The annotation to compare to</param>
 /// <returns>True if the annotations are equivalent, false otherwise</returns>
 public override bool Equals(ODataPayloadElementEquatableAnnotation other)
 {
     return(this.CastAndCheckEquality <EntitySetAnnotation>(
                other, o => o.EntitySet == this.EntitySet && o.EdmEntitySet == this.EdmEntitySet));
 }
Exemple #7
0
 /// <summary>
 /// Returns whether or not the given annotation is equal to the current annotation
 /// </summary>
 /// <param name="other">The annotation to compare to</param>
 /// <returns>True if the annotations are equivalent, false otherwise</returns>
 public override bool Equals(ODataPayloadElementEquatableAnnotation other)
 {
     return(this.CastAndCheckEquality <DataTypeAnnotation>(other, o => o.DataType.Equals(this.DataType) && o.EdmDataType.Equals(this.EdmDataType)));
 }