private void FlushChain(IncludeElementExpression expression)
            {
                List <RelationshipAttribute> fieldsInChain = _parentRelationshipStack.Reverse().ToList();

                fieldsInChain.Add(expression.Relationship);

                Chains.Add(new ResourceFieldChainExpression(fieldsInChain));
            }
Пример #2
0
        public override QueryExpression VisitIncludeElement(IncludeElementExpression expression, TArgument argument)
        {
            if (expression != null)
            {
                var newElements = VisitSequence(expression.Children, argument);

                var newExpression = new IncludeElementExpression(expression.Relationship, newElements);
                return(newExpression.Equals(expression) ? expression : newExpression);
            }

            return(null);
        }
            public override object VisitIncludeElement(IncludeElementExpression expression, object argument)
            {
                if (!expression.Children.Any())
                {
                    FlushChain(expression);
                }
                else
                {
                    _parentRelationshipStack.Push(expression.Relationship);

                    foreach (IncludeElementExpression child in expression.Children)
                    {
                        Visit(child, null);
                    }

                    _parentRelationshipStack.Pop();
                }

                return(null);
            }