/// <summary>
 /// Translates the <paramref name="query"/> into a string representation.
 /// </summary>
 /// <param name="query">The <see cref="DbInExpression"/> to translate.</param>
 /// <returns><see cref="DbExpression"/></returns>
 protected virtual DbExpression VisitQueryExpression(DbQuery query)
 {
     return(Visit(query.GetQueryExpression()));
 }
Esempio n. 2
0
 /// <summary>
 /// Specifies the column to be updated.
 /// </summary>
 /// <param name="dbUpdateQuery">The target <see cref="DbQuery{TQueryExpression}"/>.</param>
 /// <param name="columnSelector">A function used to specify the column to be updated.</param>
 /// <param name="valueSelector">A function used to specify the new value.</param>
 /// <returns><see cref="DbQuery{TQueryExpression}"/></returns>
 public static DbQuery <DbUpdateExpression> Set(this DbQuery <DbUpdateExpression> dbUpdateQuery,
                                                Func <DbExpressionFactory, DbExpression> columnSelector, Func <DbExpressionFactory, DbExpression> valueSelector)
 {
     return(Set(dbUpdateQuery, columnSelector(DbExpressionFactory), valueSelector(DbExpressionFactory)));
 }
Esempio n. 3
0
 /// <summary>
 /// Specifies the column to be updated.
 /// </summary>
 /// <param name="dbUpdateQuery">The target <see cref="DbQuery{TQueryExpression}"/>.</param>
 /// <param name="columnSelector">A function used to specify the column to be updated.</param>
 /// <param name="value">The new value.</param>
 /// <returns><see cref="DbQuery{TQueryExpression}"/></returns>
 public static DbQuery <DbUpdateExpression> Set(this DbQuery <DbUpdateExpression> dbUpdateQuery, Func <DbExpressionFactory, DbExpression> columnSelector, object value)
 {
     return(Set(dbUpdateQuery, columnSelector(DbExpressionFactory), DbExpressionFactory.Constant(value)));
 }
Esempio n. 4
0
 /// <summary>
 /// Bypasses a specified number of rows in the result set.
 /// </summary>
 /// <param name="dbSelectQuery">The target <see cref="DbQuery{TQueryExpression}"/>.</param>
 /// <param name="count">The number of rows to bypass in the result set</param>
 /// <returns><see cref="DbQuery{TQueryExpression}"/></returns>
 public static DbQuery <DbSelectExpression> Skip(this DbQuery <DbSelectExpression> dbSelectQuery, int count)
 {
     dbSelectQuery.QueryExpression.SkipExpression = DbExpressionFactory.Constant(count);
     return(dbSelectQuery);
 }
Esempio n. 5
0
 /// <summary>
 /// Creates a new <see cref="DbOrderByExpression"/> that represents an descending ordering of the result set.
 /// </summary>
 /// <param name="dbSelectQuery">The target <see cref="DbQuery{TQueryExpression}"/>.</param>
 /// <param name="expressionSelector">A function used to specify an element in the 'ORDER BY' clause.</param>
 public static DbQuery <DbSelectExpression> OrderByDescending(this DbQuery <DbSelectExpression> dbSelectQuery, Func <DbExpressionFactory, DbExpression> expressionSelector)
 {
     return(OrderBy(dbSelectQuery, expressionSelector, DbOrderByExpressionType.Ascending));
 }
 /// <summary>
 /// Specifies the values to be inserted.
 /// </summary>
 /// <param name="dbInsertQuery">The target <see cref="DbQuery{TQueryExpression}"/>.</param>
 /// <param name="valuesExpression">The <see cref="DbExpression"/> that represents the values to be inserted.</param>
 /// <returns>A <see cref="DbInsertQuery"/> instance.</returns>
 public static DbQuery <DbInsertExpression> Values(this DbQuery <DbInsertExpression> dbInsertQuery, DbExpression valuesExpression)
 {
     dbInsertQuery.QueryExpression.Values = valuesExpression;
     return(dbInsertQuery);
 }
Esempio n. 7
0
 /// <summary>
 /// Bypasses a specified number of rows in the result set.
 /// </summary>
 /// <param name="dbSelectQuery">The target <see cref="DbQuery{TQueryExpression}"/>.</param>
 /// <param name="expressionSelector">A function used to create a <see cref="DbExpression"/> that the number of rows to bypass.</param>
 /// <returns><see cref="DbQuery{TQueryExpression}"/></returns>
 public static DbQuery <DbSelectExpression> Skip(this DbQuery <DbSelectExpression> dbSelectQuery, Func <DbExpressionFactory, DbExpression> expressionSelector)
 {
     dbSelectQuery.QueryExpression.SkipExpression = expressionSelector(DbExpressionFactory);
     return(dbSelectQuery);
 }
 /// <summary>
 /// Specifies the values to be inserted.
 /// </summary>
 /// <param name="dbInsertQuery">The target <see cref="DbQuery{TQueryExpression}"/>.</param>
 /// <param name="valueSelector">A <see cref="Func{T,TResult}"/> used to specify the values to be inserted.</param>
 /// <returns>A <see cref="DbInsertQuery"/> instance.</returns>
 public static DbQuery <DbInsertExpression> Values(this DbQuery <DbInsertExpression> dbInsertQuery, params Func <DbExpressionFactory, DbExpression>[] valueSelector)
 {
     return(Values(dbInsertQuery, DbExpressionFactory.List(valueSelector.Select(e => e(DbExpressionFactory)))));
 }
Esempio n. 9
0
 /// <summary>
 /// Creates an 'INNER JOIN' between the current 'FROM' clause and the expression returned by the <paramref name="target"/> functor.
 /// </summary>
 /// <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> InnerJoin <TQueryExpression>(this DbQuery <TQueryExpression> query,
                                                                       Func <DbExpressionFactory, DbExpression> target, Func <DbExpressionFactory, DbExpression> condition)
     where TQueryExpression : DbQueryExpression, new()
 {
     return(Join(query, DbJoinExpressionType.InnerJoin, target, condition));
 }
Esempio n. 10
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)));
 }
Esempio n. 11
0
 /// <summary>
 /// Specifies the tables, views, derived tables, and joined tables used in DELETE, SELECT, and UPDATE statements.
 /// </summary>
 /// <param name="query">The target <see cref="DbQuery{TQueryExpression}"/></param>
 /// <param name="expressionSelector">A <see cref="Func{T,TResult}"/> to specify the <see cref="DbExpression"/>.</param>
 /// <returns><see cref="DbQuery{TQueryExpression}"/></returns>
 public static DbQuery <TQueryExpression> From <TQueryExpression>(this DbQuery <TQueryExpression> query, Func <DbExpressionFactory, DbExpression> expressionSelector)
     where TQueryExpression : DbQueryExpression, new()
 {
     return(From(query, expressionSelector(DbExpressionFactory)));
 }
Esempio n. 12
0
 /// <summary>
 /// Creates an 'RIGHT OUTER JOIN' between the current 'FROM' clause and the expression returned by the <paramref name="target"/> functor.
 /// </summary>
 /// <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> RightOuterJoin <TQueryExpression>(this DbQuery <TQueryExpression> query,
                                                                            DbExpression target, DbExpression condition)
     where TQueryExpression : DbQueryExpression, new()
 {
     return(Join(query, DbJoinExpressionType.RightOuterJoin, target, condition));
 }