Represents a 'JOIN' in the query.
Inheritance: DbExpression
        /// <summary>
        /// Translates the <paramref name="joinExpression"/> into a string representation.
        /// </summary>
        /// <param name="joinExpression">The <see cref="DbJoinExpression"/> to translate.</param>
        /// <returns><see cref="string"/></returns>
        protected override DbExpression VisitJoinExpression(DbJoinExpression joinExpression)
        {
            string body;

            switch (joinExpression.JoinExpressionType)
            {
            case DbJoinExpressionType.InnerJoin:
                body = "INNER JOIN {0} ON {1}";
                break;

            case DbJoinExpressionType.LeftOuterJoin:
                body = "LEFT OUTER JOIN {0} ON {1}";
                break;

            case DbJoinExpressionType.RightOuterJoin:
                body = "RIGHT OUTER JOIN {0} ON {1}";
                break;

            default:
                throw new ArgumentOutOfRangeException("joinExpression",
                                                      string.Format(
                                                          "The JoinExpressionType '{0}' is not supported",
                                                          joinExpression.JoinExpressionType));
            }

            string syntax = string.Format(body, Visit(joinExpression.Target), Visit(joinExpression.Condition));

            return(ExpressionFactory.Sql(syntax));
        }
        /// <summary>
        /// Translates the <paramref name="joinExpression"/> into a string representation.
        /// </summary>
        /// <param name="joinExpression">The <see cref="DbJoinExpression"/> to translate.</param>
        /// <returns><see cref="DbExpression"/></returns>
        protected virtual DbExpression VisitJoinExpression(DbJoinExpression joinExpression)
        {
            var conditionExpression = Visit(joinExpression.Condition);
            var targetExpression    = Visit(joinExpression.Target);

            if (!ReferenceEquals(conditionExpression, joinExpression.Condition) ||
                !ReferenceEquals(targetExpression, joinExpression.Target))
            {
                return(ExpressionFactory.MakeJoin(joinExpression.JoinExpressionType, targetExpression,
                                                  conditionExpression));
            }

            return(joinExpression);
        }
 /// <summary>
 /// Creates a new <see cref="DbJoinExpression"/>.
 /// </summary>
 /// <param name="joinType">The <see cref="DbJoinExpressionType"/> that specifies the type of join to create.</param>
 /// <param name="target">The join target.</param>
 /// <param name="condition">The join condition.</param>
 /// <returns>A <see cref="DbJoinExpression"/> instance.</returns>
 public DbJoinExpression MakeJoin(DbJoinExpressionType joinType, DbExpression target, DbExpression condition)
 {
     var joinExpression = new DbJoinExpression(joinType, target, condition);
     return joinExpression;
 }
        /// <summary>
        /// Translates the <paramref name="joinExpression"/> into a string representation.
        /// </summary>
        /// <param name="joinExpression">The <see cref="DbJoinExpression"/> to translate.</param>
        /// <returns><see cref="string"/></returns>
        protected override DbExpression VisitJoinExpression(DbJoinExpression joinExpression)
        {
            string body;
            switch (joinExpression.JoinExpressionType)
            {
                case DbJoinExpressionType.InnerJoin:
                    body = "INNER JOIN {0} ON {1}";
                    break;
                case DbJoinExpressionType.LeftOuterJoin:
                    body = "LEFT OUTER JOIN {0} ON {1}";
                    break;
                case DbJoinExpressionType.RightOuterJoin:
                    body = "RIGHT OUTER JOIN {0} ON {1}";
                    break;
                default:
                    throw new ArgumentOutOfRangeException("joinExpression",
                                                          string.Format(
                                                              "The JoinExpressionType '{0}' is not supported",
                                                              joinExpression.JoinExpressionType));
            }

            string syntax = string.Format(body, Visit(joinExpression.Target), Visit(joinExpression.Condition));
            return ExpressionFactory.Sql(syntax);
        }
        /// <summary>
        /// Translates the <paramref name="joinExpression"/> into a string representation.
        /// </summary>
        /// <param name="joinExpression">The <see cref="DbJoinExpression"/> to translate.</param>
        /// <returns><see cref="DbExpression"/></returns>
        protected virtual DbExpression VisitJoinExpression(DbJoinExpression joinExpression)
        {
            var conditionExpression = Visit(joinExpression.Condition);
            var targetExpression = Visit(joinExpression.Target);
            if (!ReferenceEquals(conditionExpression,joinExpression.Condition) ||
                !ReferenceEquals(targetExpression,joinExpression.Target))
            {
                return ExpressionFactory.MakeJoin(joinExpression.JoinExpressionType, targetExpression,
                                                  conditionExpression);
            }

            return joinExpression;
        }