示例#1
0
        /// <summary>
        /// Appends a name of a property/link/type to the current expand path.
        /// </summary>
        /// <param name="name">name of the property/link/type which needs to be added to the expand path.</param>
        /// <param name="isStructural">is this a structural property.</param>
        private void AppendToExpandPath(string name, bool isStructural)
        {
            PathSegmentToken path     = this.expandPaths.LastOrDefault();
            NonSystemToken   newToken = new NonSystemToken(name, /*namedValues*/ null, /*nextToken*/ null);

            newToken.IsStructuralProperty = isStructural;
            if (path != null)
            {
                expandPaths.Remove(path);
                AddNewEndingTokenVisitor addNewEndingTokenVisitor = new AddNewEndingTokenVisitor(newToken);
                path.Accept(addNewEndingTokenVisitor);
                expandPaths.Add(path);
            }
            else
            {
                expandPaths.Add(newToken);
            }
        }
示例#2
0
        /// <summary>
        /// Starts a new path.
        /// </summary>
        public void StartNewPath()
        {
            Debug.Assert(this.ParamExpressionInScope != null, "this.ParamExpressionInScope != null -- should not be starting new path with no lambda parameter in scope.");

            PathSegmentToken basePath = basePaths[this.ParamExpressionInScope];
            PathSegmentToken newExpandPathToAdd;

            if (basePath != null)
            {
                NewTreeBuilder newTreeBuilder = new NewTreeBuilder();
                newExpandPathToAdd = basePath.Accept(newTreeBuilder);
            }
            else
            {
                newExpandPathToAdd = null;
            }

            expandPaths.Add(newExpandPathToAdd);

            firstSegmentInNewPath = true;
            basePathIsEmpty       = basePath == null;
        }