/// <summary> /// Parses the segments of a path in the select clause. /// </summary> /// <param name="segments">The segments of the select path.</param> /// <param name="index">The index of the segment to parse.</param> private void ParsePathSegment(string[] segments, int index) { Debug.Assert(segments != null, "segments != null"); Debug.Assert(index >= 0 && index < segments.Length, "index >= 0 && index < segments.Length"); // NOTE: Each path is the name of a property or a series of property names // separated by slash ('/'). The special star ('*') character is only supported at the end of a path. string currentSegment = segments[index].Trim(); if (this.selectedProperties == null) { this.selectedProperties = CreateSelectedPropertiesHashSet(); } bool isStar = string.CompareOrdinal(ProjectedPropertiesAnnotation.StarSegment, currentSegment) == 0; bool isLastSegment = index == segments.Length - 1; if (!isLastSegment) { if (isStar) { throw new ODataException(ODataErrorStrings.SelectedPropertiesNode_StarSegmentNotLastSegment); } SelectedPropertiesNode childNode = this.EnsureChildAnnotation(currentSegment); childNode.ParsePathSegment(segments, index + 1); } else { this.selectedProperties.Add(currentSegment); } this.hasWildcard |= isStar; }