public virtual JoinExpressionBase AddInnerJoin(
            [NotNull] TableExpressionBase tableExpression,
            [NotNull] IEnumerable <ColumnExpression> projection)
        {
            Check.NotNull(tableExpression, "tableExpression");
            Check.NotNull(projection, "projection");

            var innerJoinExpression = new InnerJoinExpression(tableExpression);

            _tables.Add(innerJoinExpression);
            _projection.AddRange(projection);

            return(innerJoinExpression);
        }
        public virtual JoinExpressionBase AddInnerJoin(
            [NotNull] TableExpressionBase tableExpression,
            [NotNull] IEnumerable <Expression> projection)
        {
            Check.NotNull(tableExpression, nameof(tableExpression));
            Check.NotNull(projection, nameof(projection));

            tableExpression.Alias = CreateUniqueTableAlias(tableExpression.Alias);

            var innerJoinExpression = new InnerJoinExpression(tableExpression);

            _tables.Add(innerJoinExpression);
            _projection.AddRange(projection);

            return(innerJoinExpression);
        }
        public virtual InnerJoinExpression AddInnerJoin(
            [NotNull] SelectExpression selectExpression, bool mergeProjection)
        {
            Check.NotNull(selectExpression, "selectExpression");
            Contract.Assert(!selectExpression.OrderBy.Any());

            var joinedTable = selectExpression.Tables.Single();

            var innerJoinExpression
                = new InnerJoinExpression(
                      joinedTable.Table,
                      joinedTable.Schema,
                      joinedTable.Alias,
                      joinedTable.QuerySource);

            _tables.Add(innerJoinExpression);

            if (mergeProjection)
            {
                _projection.AddRange(selectExpression.Projection);
            }

            return(innerJoinExpression);
        }
        public virtual JoinExpressionBase AddInnerJoin(
            [NotNull] TableExpressionBase tableExpression,
            [NotNull] IEnumerable<Expression> projection)
        {
            Check.NotNull(tableExpression, nameof(tableExpression));
            Check.NotNull(projection, nameof(projection));

            tableExpression.Alias = CreateUniqueTableAlias(tableExpression.Alias);

            var innerJoinExpression = new InnerJoinExpression(tableExpression);

            _tables.Add(innerJoinExpression);
            _projection.AddRange(projection);

            return innerJoinExpression;
        }
        public virtual InnerJoinExpression AddInnerJoin(
            [NotNull] SelectExpression selectExpression, bool mergeProjection)
        {
            Check.NotNull(selectExpression, "selectExpression");
            Contract.Assert(!selectExpression.OrderBy.Any());

            var joinedTable = selectExpression.Tables.Single();

            var innerJoinExpression
                = new InnerJoinExpression(
                    joinedTable.Table,
                    joinedTable.Schema,
                    joinedTable.Alias,
                    joinedTable.QuerySource);

            _tables.Add(innerJoinExpression);

            if (mergeProjection)
            {
                _projection.AddRange(selectExpression.Projection);
            }

            return innerJoinExpression;
        }