private JoinExpressionBase AdjustJoinExpression(
            SelectExpression selectExpression, JoinExpressionBase joinExpression)
        {
            var subquery
                = new SelectExpression(_querySqlGeneratorFactory, _queryCompilationContext)
                {
                Alias = joinExpression.Alias
                };

            // Don't create new alias when adding tables to subquery
            subquery.AddTable(joinExpression.TableExpression, createUniqueAlias: false);
            subquery.ProjectStarAlias = joinExpression.Alias;
            subquery.IsProjectStar    = true;
            subquery.Predicate        = selectExpression.Predicate;

            var newJoinExpression
                = joinExpression is LeftOuterJoinExpression
                    ? (JoinExpressionBase) new LeftOuterJoinExpression(subquery)
                    : new InnerJoinExpression(subquery);

            newJoinExpression.QuerySource = joinExpression.QuerySource;
            newJoinExpression.Alias       = joinExpression.Alias;

            return(newJoinExpression);
        }
Example #2
0
        private JoinExpressionBase AdjustJoinExpression(
            SelectExpression selectExpression, JoinExpressionBase joinExpression)
        {
            var subquery = new SelectExpression(_querySqlGeneratorFactory, joinExpression.Alias);

            subquery.AddTable(joinExpression.TableExpression);
            subquery.IsProjectStar = true;
            subquery.Predicate     = selectExpression.Predicate;

            var newJoinExpression = joinExpression is LeftOuterJoinExpression
                ? (JoinExpressionBase) new LeftOuterJoinExpression(subquery)
                : new InnerJoinExpression(subquery);

            newJoinExpression.QuerySource = joinExpression.QuerySource;
            newJoinExpression.Alias       = joinExpression.Alias;

            return(newJoinExpression);
        }