Exemple #1
0
        protected override QueryModel ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
        {
            Utils.CheckNotNull("queryModel", queryModel);

            if (IsLetNode)
            {
                // For let nodes, we insert a LetClause instance, then adapt the SelectClause to select the data bubbling out of the LetClause.
                var resolvedLetExpression = GetResolvedLetExpression(clauseGenerationContext);
                var letClause             = new LetClause(_letConstruction.Constructor.GetParameters()[1].Name, resolvedLetExpression);
                queryModel.BodyClauses.Add(letClause);

                clauseGenerationContext.AddContextInfo(this, letClause);

                queryModel.SelectClause.Selector = GetResolvedAdaptedSelector(clauseGenerationContext);
                return(queryModel);
            }

            return(base.ApplyNodeSpecificSemantics(queryModel, clauseGenerationContext));
        }
        protected override QueryModel ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
        {
            Utils.CheckNotNull("queryModel", queryModel);

            var resolvedCollectionSelector = GetResolvedCollectionSelector(clauseGenerationContext);
            var resolvedLetSelector        = GetResolvedLetSelector(clauseGenerationContext);

            var clause = new LetClause(CollectionSelector.Parameters[1].Name, resolvedLetSelector, resolvedCollectionSelector);

            queryModel.BodyClauses.Add(clause);

            //var clause = new AdditionalFromClause(ResultSelector.Parameters[1].Name, ResultSelector.Parameters[1].Type, resolvedCollectionSelector);
            //queryModel.BodyClauses.Add(clause);

            clauseGenerationContext.AddContextInfo(this, clause);

            var selectClause = queryModel.SelectClause;

            selectClause.Selector =
                //GetResolvedCollectionSelector(clauseGenerationContext);
                GetResolvedResultSelector(clauseGenerationContext);

            return(queryModel);
        }
        public void VisitLetClause(LetClause letClause, QueryModel queryModel, Type lhsType)
        {
            QueryText.AppendFormat(" let {0} = ", LinqUtility.ResolvePropertyName(letClause.ItemName));
            GetAqlExpression(letClause.LetExpression, queryModel);

            var subQuery = letClause.SubqueryExpression as SubQueryExpression;
            if (subQuery != null)
            {
                GetAqlExpression(subQuery, queryModel, handleLet: true);
                this.DontReturn = true;
            }
        }
        protected override QueryModel ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
        {
            Utils.CheckNotNull("queryModel", queryModel);

            if (IsLetNode)
            {
                // For let nodes, we insert a LetClause instance, then adapt the SelectClause to select the data bubbling out of the LetClause.
                var resolvedLetExpression = GetResolvedLetExpression(clauseGenerationContext);
                var letClause = new LetClause(_letConstruction.Constructor.GetParameters()[1].Name, resolvedLetExpression);
                queryModel.BodyClauses.Add(letClause);

                clauseGenerationContext.AddContextInfo(this, letClause);

                queryModel.SelectClause.Selector = GetResolvedAdaptedSelector(clauseGenerationContext);
                return queryModel;
            }

            return base.ApplyNodeSpecificSemantics(queryModel, clauseGenerationContext);
        }
        protected override QueryModel ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
        {
            Utils.CheckNotNull("queryModel", queryModel);

            var resolvedCollectionSelector = GetResolvedCollectionSelector(clauseGenerationContext);
            var resolvedLetSelector = GetResolvedLetSelector(clauseGenerationContext);

            var clause = new LetClause(CollectionSelector.Parameters[1].Name, resolvedLetSelector, resolvedCollectionSelector);
            queryModel.BodyClauses.Add(clause);

            //var clause = new AdditionalFromClause(ResultSelector.Parameters[1].Name, ResultSelector.Parameters[1].Type, resolvedCollectionSelector);
            //queryModel.BodyClauses.Add(clause);

            clauseGenerationContext.AddContextInfo(this, clause);

            var selectClause = queryModel.SelectClause;
            selectClause.Selector = 
                //GetResolvedCollectionSelector(clauseGenerationContext);
                GetResolvedResultSelector(clauseGenerationContext);

            return queryModel;
        }