Skip to content

DmQuery`2 ​

Namespace: MJCZone.DapperMatic.Dml

Assembly: MJCZone.DapperMatic

Summary ​

A query whose rows are read as something else, such as some of their columns.

sealed public

Contents ​

Methods (9)

Methods ​

MethodSummary
DistinctReturns each distinct result once. The selector must be of columns only, such as <c>o => ne...
ToListAsyncReads the results.
FirstAsyncReads the first result: in the query's order, or in key order if it has none.
SingleAsyncReads the one result the query returns.
ToSqlWrites the SQL that CancellationToken) runs, without running it....
GetType
ToString
Equals
GetHashCode

Distinct ​

Returns each distinct result once. The selector must be of columns only, such as <c>o => new { o.CustomerId, o.Status }</c>, since the database compares them.

csharp
DmQuery&lt;T, TResult&gt; Distinct()

Returns ​

Type: DmQuery<T, TResult>

The query.

ToListAsync ​

Reads the results.

csharp
Task&lt;List&lt;TResult&gt;&gt; ToListAsync(
    IDbTransaction tx,
    CancellationToken cancellationToken)

Parameters ​

  • tx (IDbTransaction) - The transaction to use, or null.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task&lt;List&lt;TResult&gt;&gt;

The results.

FirstAsync ​

Reads the first result: in the query's order, or in key order if it has none.

csharp
Task&lt;TResult?&gt; FirstAsync(
    IDbTransaction tx,
    CancellationToken cancellationToken)

Parameters ​

  • tx (IDbTransaction) - The transaction to use, or null.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task&lt;TResult?&gt;

The result, or the default (null for a class) if there is none.

SingleAsync ​

Reads the one result the query returns.

csharp
Task&lt;TResult?&gt; SingleAsync(
    IDbTransaction tx,
    CancellationToken cancellationToken)

Parameters ​

  • tx (IDbTransaction) - The transaction to use, or null.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task&lt;TResult?&gt;

The result, or the default (null for a class) if there is none.

ToSql ​

Writes the SQL that CancellationToken) runs, without running it.

csharp
DmStatement ToSql()

Returns ​

Type: DmStatement

The SQL and its parameters.

GetType ​

csharp
GetType()

ToString ​

csharp
ToString()

Equals ​

csharp
Equals()

GetHashCode ​

csharp
GetHashCode()