コード例 #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));
        }