DmQuery`1
Namespace: MJCZone.DapperMatic.Dml
Assembly: MJCZone.DapperMatic
Summary
A query of a model's rows: one <c>SELECT</c>, built up by <c>Where</c>, <c>OrderBy</c>, <c>Skip</c>, <c>Take</c>, <c>Distinct</c> and <c>Select</c>, and run by one of the <c>...Async</c> methods.
sealed public
Contents
Methods (39)
Methods
| Method | Summary |
|---|---|
| Where | |
| WhereExists | |
| WhereNotExists | |
| WhereExists | |
| WhereNotExists | |
| OrderBy | |
| OrderByDescending | |
| ThenBy | |
| ThenByDescending | |
| Skip | Skips rows. |
| Take | Returns at most a number of rows. |
| Distinct | Returns each distinct row once. |
| IncludeDeleted | Reads deleted rows of models with a <c>[DmSoftDelete]</c> too: the query's, its relation... |
| OnlyDeleted | Reads only the query's deleted rows, with its relations' and includes' rows that are not deleted. |
| Include | |
| Include | |
| Select | |
| Join | |
| LeftJoin | |
| GroupBy | |
| GroupBy | |
| After | Continues from a page: CancellationToken) then reads the rows after the cursor, in the same order.... |
| ToPageAsync | Reads a page of rows in keyset order: the query's own ordering columns, then the model's key, so tha... |
| ToListAsync | Reads the rows. |
| FirstAsync | Reads the first row: in the query's order, or in key order if it has none. |
| SingleAsync | Reads the one row the query returns. |
| CountAsync | Counts the rows the query returns. |
| ExistsAsync | Tells whether the query returns any rows. |
| SumAsync | Adds up a value over the rows the query returns, skipping NULLs. |
| MinAsync | Finds the least value over the rows the query returns. |
| MaxAsync | Finds the greatest value over the rows the query returns. |
| AverageAsync | Averages a number over the rows the query returns, skipping NULLs, with a fraction even for integers... |
| AverageAsync | Averages a number over the rows the query returns, skipping NULLs, with a fraction even for integers... |
| AverageAsync | Averages a number over the rows the query returns, skipping NULLs, with a fraction even for integers... |
| ToSql | Writes the SQL that CancellationToken) runs, without running it.... |
| GetType | |
| ToString | |
| Equals | |
| GetHashCode |
Where
Where()WhereExists
WhereExists()WhereNotExists
WhereNotExists()WhereExists
WhereExists()WhereNotExists
WhereNotExists()OrderBy
OrderBy()OrderByDescending
OrderByDescending()ThenBy
ThenBy()ThenByDescending
ThenByDescending()Skip
Skips rows.
DmQuery<T> Skip(int count)Parameters
- count (int) - The number of rows to skip.
Returns
Type: DmQuery<T>
The query.
Take
Returns at most a number of rows.
DmQuery<T> Take(int count)Parameters
- count (int) - The most rows to return.
Returns
Type: DmQuery<T>
The query.
Distinct
Returns each distinct row once.
DmQuery<T> Distinct()Returns
Type: DmQuery<T>
The query.
IncludeDeleted
Reads deleted rows of models with a <c>[DmSoftDelete]</c> too: the query's, its relations' and its includes'.
DmQuery<T> IncludeDeleted()Returns
Type: DmQuery<T>
The query.
OnlyDeleted
Reads only the query's deleted rows, with its relations' and includes' rows that are not deleted.
DmQuery<T> OnlyDeleted()Returns
Type: DmQuery<T>
The query.
Include
Include()Include
Include()Select
Select()Join
Join()LeftJoin
LeftJoin()GroupBy
GroupBy()GroupBy
GroupBy()After
Continues from a page: CancellationToken) then reads the rows after the cursor, in the same order.
DmQuery<T> After(string cursor)Parameters
- cursor (string) - , or one the web API gave; null for the first page.
Returns
Type: DmQuery<T>
The query.
ToPageAsync
Reads a page of rows in keyset order: the query's own ordering columns, then the model's key, so that pages never skip or repeat a row however deep they go; from the cursor String) gives, or the start.
Task<DmPage<T>> ToPageAsync(
int size,
IDbTransaction tx,
CancellationToken cancellationToken)Parameters
- size (int) - The most rows the page holds.
- tx (IDbTransaction) - The transaction to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<DmPage<T>>
The rows, and the cursor of the next page: null when this one is not full.
ToListAsync
Reads the rows.
Task<List<T>> ToListAsync(
IDbTransaction tx,
CancellationToken cancellationToken)Parameters
- tx (IDbTransaction) - The transaction to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<List<T>>
The rows.
FirstAsync
Reads the first row: in the query's order, or in key order if it has none.
Task<T?> FirstAsync(IDbTransaction tx, CancellationToken cancellationToken)Parameters
- tx (IDbTransaction) - The transaction to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<T?>
The row, or null if there is none.
SingleAsync
Reads the one row the query returns.
Task<T?> SingleAsync(IDbTransaction tx, CancellationToken cancellationToken)Parameters
- tx (IDbTransaction) - The transaction to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<T?>
The row, or null if there is none.
CountAsync
Counts the rows the query returns.
Task<long> CountAsync(IDbTransaction tx, CancellationToken cancellationToken)Parameters
- tx (IDbTransaction) - The transaction to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<long>
The number of rows.
ExistsAsync
Tells whether the query returns any rows.
Task<bool> ExistsAsync(IDbTransaction tx, CancellationToken cancellationToken)Parameters
- tx (IDbTransaction) - The transaction to use, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<bool>
True if it does.
SumAsync
Adds up a value over the rows the query returns, skipping NULLs.
Task<TValue> SumAsync(
Func{`0 selector,
``0}} tx,
IDbTransaction cancellationToken)Parameters
- selector (Func{`0) - .
- tx (``0}}) - The transaction to use, or null.
- cancellationToken (IDbTransaction) - The cancellation token.
Returns
Type: Task<TValue>
The sum: 0 if there are no rows, as in LINQ.
MinAsync
Finds the least value over the rows the query returns.
Task<TValue> MinAsync(
Func{`0 selector,
``0}} tx,
IDbTransaction cancellationToken)Parameters
- selector (Func{`0) - The value.
- tx (``0}}) - The transaction to use, or null.
- cancellationToken (IDbTransaction) - The cancellation token.
Returns
Type: Task<TValue>
The least value; null if there are no rows and the value can be null.
MaxAsync
Finds the greatest value over the rows the query returns.
Task<TValue> MaxAsync(
Func{`0 selector,
``0}} tx,
IDbTransaction cancellationToken)Parameters
- selector (Func{`0) - The value.
- tx (``0}}) - The transaction to use, or null.
- cancellationToken (IDbTransaction) - The cancellation token.
Returns
Type: Task<TValue>
The greatest value; null if there are no rows and the value can be null.
AverageAsync
Averages a number over the rows the query returns, skipping NULLs, with a fraction even for integers.
Task<Nullable<double>> AverageAsync(
Func{`0 selector,
``0}} tx,
IDbTransaction cancellationToken)Parameters
- selector (Func{`0) - The number.
- tx (``0}}) - The transaction to use, or null.
- cancellationToken (IDbTransaction) - The cancellation token.
Returns
Type: Task<Nullable<double>>
The average, or null if there are no values.
AverageAsync
Averages a number over the rows the query returns, skipping NULLs, with a fraction even for integers.
Task<Nullable<double>> AverageAsync(
Func{`0 selector,
``0}} tx,
IDbTransaction cancellationToken)Parameters
- selector (Func{`0) - The number.
- tx (``0}}) - The transaction to use, or null.
- cancellationToken (IDbTransaction) - The cancellation token.
Returns
Type: Task<Nullable<double>>
The average, or null if there are no values.
AverageAsync
Averages a number over the rows the query returns, skipping NULLs, with a fraction even for integers.
Task<Nullable<double>> AverageAsync(
Func{`0 selector,
``0}} tx,
IDbTransaction cancellationToken)Parameters
- selector (Func{`0) - The number.
- tx (``0}}) - The transaction to use, or null.
- cancellationToken (IDbTransaction) - The cancellation token.
Returns
Type: Task<Nullable<double>>
The average, or null if there are no values.
ToSql
Writes the SQL that CancellationToken) runs, without running it.
DmStatement ToSql()Returns
Type: DmStatement
The SQL and its parameters.
GetType
GetType()ToString
ToString()Equals
Equals()GetHashCode
GetHashCode()