예제 #1
0
        /// <summary>
        /// Gets the relatedPropertyPathItems without first item in this information.
        /// </summary>
        /// <returns>The relatedPropertyPathItems without first item in this information.</returns>
        public RelatedEntityInfo WithoutFirst()
        {
            if (relatedPropertyPathItems.Length == 0)
            {
                return(new RelatedEntityInfo());
            }

            var keyPath = RelatedKeyPath.Substring(relatedKeyPathItems[0].Length);

            if (keyPath.StartsWith("."))
            {
                keyPath = keyPath.Remove(0, 1);
            }

            return(new RelatedEntityInfo(RelatedPropertyPath.Substring(
                                             relatedPropertyPathItems[0].Length).TrimStart('.'), keyPath));
        }
예제 #2
0
        /// <summary>
        /// Gets the relatedPropertyPathItems without last item in this information.
        /// </summary>
        /// <returns>The relatedPropertyPathItems without last item in this information.</returns>
        public RelatedEntityInfo WithoutLast()
        {
            if (relatedPropertyPathItems.Length == 0)
            {
                return(new RelatedEntityInfo());
            }

            var propertyPath = RelatedPropertyPath.Substring(0, RelatedPropertyPath.Length
                                                             - relatedPropertyPathItems[relatedPropertyPathItems.Length - 1].Length).TrimEnd('.');

            var keyPath = RelatedKeyPath.Substring(0, RelatedKeyPath.Length
                                                   - relatedKeyPathItems[relatedKeyPathItems.Length - 1].Length);

            if (keyPath.EndsWith("."))
            {
                keyPath = keyPath.Remove(keyPath.Length - 1, 1);
            }

            return(new RelatedEntityInfo(propertyPath, keyPath));
        }
예제 #3
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 /// <returns>
 /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
 /// </returns>
 public override int GetHashCode()
 {
     return(RelatedPropertyPath.GetHashCode());
 }
예제 #4
0
        /// <summary>
        /// Checks if the current information includes the specified information.
        /// </summary>
        /// <param name="other">The other.</param>
        /// <returns><c>true</c> if the current information includes the specified information, otherwise <c>false</c>.</returns>
        /// <exception cref="System.ArgumentNullException">The <paramref name="other"/> is null.</exception>
        public bool Includes(RelatedEntityInfo other)
        {
            Error.ArgumentNullException_IfNull(other, "other");

            return(RelatedPropertyPath.StartsWith(other.RelatedPropertyPath));
        }