Пример #1
0
        protected sealed override ResultOperatorBase CreateResultOperator(
            ClauseGenerationContext clauseGenerationContext)
        {
            var resultOperator = CreateSpecificResultOperator();

            clauseGenerationContext.AddContextInfo(this, resultOperator);
            return(resultOperator);
        }
        private MainFromClause CreateMainFromClause(ClauseGenerationContext clauseGenerationContext)
        {
            var fromClause = new MainFromClause(
                AssociatedIdentifier,
                _querySourceElementType,
                ParsedExpression);

            clauseGenerationContext.AddContextInfo(this, fromClause);
            return(fromClause);
        }
Пример #3
0
        public JoinClause CreateJoinClause(ClauseGenerationContext clauseGenerationContext)
        {
            var dummyInnerKeySelector = Expression.Constant(null);
            var joinClause            = new JoinClause(
                ResultSelector.Parameters[1].Name,
                ResultSelector.Parameters[1].Type,
                InnerSequence,
                GetResolvedOuterKeySelector(clauseGenerationContext),
                dummyInnerKeySelector);

            clauseGenerationContext.AddContextInfo(this, joinClause);

            joinClause.InnerKeySelector = GetResolvedInnerKeySelector(clauseGenerationContext);
            return(joinClause);
        }
Пример #4
0
        protected override void ApplyNodeSpecificSemantics(QueryModel queryModel,
                                                           ClauseGenerationContext clauseGenerationContext)
        {
            ArgumentUtility.CheckNotNull("queryModel", queryModel);

            var resolvedCollectionSelector = GetResolvedCollectionSelector(clauseGenerationContext);
            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 = GetResolvedResultSelector(clauseGenerationContext);
        }
        protected override ResultOperatorBase CreateResultOperator(ClauseGenerationContext clauseGenerationContext)
        {
            var resolvedKeySelector = GetResolvedKeySelector(clauseGenerationContext);

            var resolvedElementSelector = GetResolvedOptionalElementSelector(clauseGenerationContext);

            if (resolvedElementSelector == null)
            {
                // supply a default element selector if none is given
                // just resolve KeySelector.Parameters[0], that's the input data flowing in from the source node
                resolvedElementSelector = Source.Resolve(KeySelector.Parameters[0], KeySelector.Parameters[0],
                                                         clauseGenerationContext);
            }

            var resultOperator =
                new GroupResultOperator(AssociatedIdentifier, resolvedKeySelector, resolvedElementSelector);

            clauseGenerationContext.AddContextInfo(this, resultOperator);
            return(resultOperator);
        }
        protected override void ApplyNodeSpecificSemantics(QueryModel queryModel,
                                                           ClauseGenerationContext clauseGenerationContext)
        {
            ArgumentUtility.CheckNotNull("queryModel", queryModel);

            var joinResultSelector = Expression.Lambda(Expression.Constant(null), OuterKeySelector.Parameters[0],
                                                       InnerKeySelector.Parameters[0]);
            var joinParseInfo      = new MethodCallExpressionParseInfo(AssociatedIdentifier, Source, ParsedExpression);
            var joinExpressionNode = new JoinExpressionNode(joinParseInfo, InnerSequence, OuterKeySelector,
                                                            InnerKeySelector, joinResultSelector);

            var joinClause      = joinExpressionNode.CreateJoinClause(clauseGenerationContext);
            var groupJoinClause = new GroupJoinClause(ResultSelector.Parameters[1].Name,
                                                      ResultSelector.Parameters[1].Type, joinClause);

            clauseGenerationContext.AddContextInfo(this, groupJoinClause);
            queryModel.BodyClauses.Add(groupJoinClause);

            var selectClause = queryModel.SelectClause;

            selectClause.Selector = GetResolvedResultSelector(clauseGenerationContext);
        }