Ejemplo n.º 1
0
        /// <summary>
        /// Creates a <see cref="DbJoinExpression"/> between the current 'FROM' clause and the expression returned by the <paramref name="target"/> functor.
        /// </summary>
        /// <param name="joinExpressionType">Specifies the type of join expression.</param>
        /// <param name="query">The target <see cref="DbQuery{TQueryExpression}"/></param>
        /// <param name="target">The target join expression.</param>
        /// <param name="condition">A <see cref="DbExpression"/> that specifies the join condition.</param>
        /// <returns><see cref="DbQuery{TQueryExpression}"/></returns>
        public static DbQuery <TQueryExpression> Join <TQueryExpression>(this DbQuery <TQueryExpression> query,
                                                                         DbJoinExpressionType joinExpressionType, DbExpression target,
                                                                         DbExpression condition) where TQueryExpression : DbQueryExpression, new()
        {
            var dbExpression = (DbExpression)DbExpressionFactory.MakeJoin(joinExpressionType, target, condition);

            if (!query.QueryExpression.FromExpression.IsNull())
            {
                dbExpression = DbExpressionFactory.Concat(query.QueryExpression.FromExpression, dbExpression);
            }
            query.QueryExpression.FromExpression = dbExpression;
            return(query);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DbJoinExpression"/> class.
 /// </summary>
 /// <param name="joinExpressionType">The <see cref="DbJoinExpressionType"/> that specifies the type of <see cref="DbJoinExpression"/> to create.</param>
 /// <param name="target">The join target <see cref="DbExpression"/>.</param>
 /// <param name="condition">The join condition.</param>
 internal DbJoinExpression(DbJoinExpressionType joinExpressionType, DbExpression target, DbExpression condition)
 {
     JoinExpressionType = joinExpressionType;
     Target             = target;
     Condition          = condition;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DbJoinExpression"/> class.
 /// </summary>
 /// <param name="joinExpressionType">The <see cref="DbJoinExpressionType"/> that specifies the type of <see cref="DbJoinExpression"/> to create.</param>
 /// <param name="target">The join target <see cref="DbExpression"/>.</param>
 /// <param name="condition">The join condition.</param>
 internal DbJoinExpression(DbJoinExpressionType joinExpressionType, DbExpression target, DbExpression condition)
 {
     JoinExpressionType = joinExpressionType;
     Target = target;
     Condition = condition;
 }
 /// <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;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a <see cref="DbJoinExpression"/> between the current 'FROM' clause and the expression returned by the <paramref name="target"/> functor.
 /// </summary>
 /// <param name="joinExpressionType">Specifies the type of join expression.</param>
 /// <param name="query">The target <see cref="DbQuery{TQueryExpression}"/></param>
 /// <param name="target">The target join expression.</param>
 /// <param name="condition">A <see cref="DbExpression"/> that specifies the join condition.</param>
 /// <returns><see cref="DbQuery{TQueryExpression}"/></returns>
 public static DbQuery <TQueryExpression> Join <TQueryExpression>(this DbQuery <TQueryExpression> query,
                                                                  DbJoinExpressionType joinExpressionType, Func <DbExpressionFactory, DbExpression> target,
                                                                  Func <DbExpressionFactory, DbExpression> condition) where TQueryExpression : DbQueryExpression, new()
 {
     return(Join(query, joinExpressionType, target(DbExpressionFactory), condition(DbExpressionFactory)));
 }