Esempio n. 1
0
        S IAstVisitor <T, S> .VisitQueryJoinClause(QueryJoinClause queryJoinClause, T data)
        {
            var handler = QueryJoinClauseVisited;

            if (handler != null)
            {
                handler(queryJoinClause, data);
            }
            return(VisitChildren(queryJoinClause, data));
        }
Esempio n. 2
0
        protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
        {
            QueryJoinClause o = other as QueryJoinClause;

            return(o != null && this.IsGroupJoin == o.IsGroupJoin &&
                   this.Type.DoMatch(o.Type, match) && MatchString(this.JoinIdentifier, o.JoinIdentifier) &&
                   this.InExpression.DoMatch(o.InExpression, match) && this.OnExpression.DoMatch(o.OnExpression, match) &&
                   this.EqualsExpression.DoMatch(o.EqualsExpression, match) &&
                   MatchString(this.IntoIdentifier, o.IntoIdentifier));
        }
Esempio n. 3
0
            public override AstNode VisitQueryJoinClause(QueryJoinClause queryJoinClause)
            {
                Expression resultSelectorBody     = null;
                var        inExpression           = VisitNested(queryJoinClause.InExpression, null);
                var        key1SelectorFirstParam = CreateParameterForCurrentRangeVariable();
                var        key1Selector           = CreateLambda(new[] { key1SelectorFirstParam }, VisitNested(queryJoinClause.OnExpression, key1SelectorFirstParam));
                var        key2Param    = CreateParameter(Identifier.Create(queryJoinClause.JoinIdentifier));
                var        key2Selector = CreateLambda(new[] { key2Param }, VisitNested(queryJoinClause.EqualsExpression, null));

                var resultSelectorFirstParam = CreateParameterForCurrentRangeVariable();

                var select = GetNextQueryClause(queryJoinClause) as QuerySelectClause;

                if (select != null)
                {
                    resultSelectorBody = VisitNested(select.Expression, resultSelectorFirstParam);
                    eatSelect          = true;
                }

                if (queryJoinClause.IntoKeyword.IsNull)
                {
                    // Normal join
                    if (resultSelectorBody == null)
                    {
                        resultSelectorBody = AddMemberToCurrentTransparentType(resultSelectorFirstParam, queryJoinClause.JoinIdentifierToken, new IdentifierExpression(queryJoinClause.JoinIdentifier), false);
                    }

                    var resultSelector = CreateLambda(new[] { resultSelectorFirstParam, CreateParameter(Identifier.Create(queryJoinClause.JoinIdentifier)) }, resultSelectorBody);
                    rangeVariables[queryJoinClause.JoinIdentifierToken] = key2Param;
                    return(currentResult.Invoke("Join", inExpression, key1Selector, key2Selector, resultSelector));
                }
                else
                {
                    // Group join
                    if (resultSelectorBody == null)
                    {
                        resultSelectorBody = AddMemberToCurrentTransparentType(resultSelectorFirstParam, queryJoinClause.IntoIdentifierToken, new IdentifierExpression(queryJoinClause.IntoIdentifier), false);
                    }

                    var intoParam      = CreateParameter(Identifier.Create(queryJoinClause.IntoIdentifier));
                    var resultSelector = CreateLambda(new[] { resultSelectorFirstParam, intoParam }, resultSelectorBody);
                    rangeVariables[queryJoinClause.IntoIdentifierToken] = intoParam;

                    return(currentResult.Invoke("GroupJoin", inExpression, key1Selector, key2Selector, resultSelector));
                }
            }
Esempio n. 4
0
 void IAstVisitor.VisitQueryJoinClause(QueryJoinClause queryJoinClause)
 {
     Visit(EnterQueryJoinClause, LeaveQueryJoinClause, queryJoinClause);
 }