Reference
ExecuteAsync
The ExecuteAsync
method is used to asynchronously execute a SQL statement against a database.
Any query type or stored procedure
Syntax
ExecuteAsync(
[{connection}]
[,{commandTimeout}]
[,{cancellationToken}]
)
Arguments
- connection
- – A SQL connection to use for query execution. dbExpression will open the connection if it isn't already open, and will honor a transaction if one has been started on an open connection.
- commandTimeout
- – The execution duration (in seconds) of a query before execution will timeout if not yet complete.
- cancellationToken
- – dbExpression will check at each stage of the execution pipeline workflow and throw an exception if the token has been cancelled.
SelectOne
or SelectMany
queries and stored procedures
For SelectOne
and SelectMany
queries, execution signatures include delegates for overriding the management of rowset data. Use these delegates when the configurations for rowset data mapping needs to be replaced at the query level. These signatures are available for queries for entities and dynamics - but not scalar values.
Syntax
ExecuteAsync(
[{commandTimeout}]
[,{connection}]
[,{read|map}]
[,{cancellationToken}]
)
Arguments
- connection
- – A SQL connection to use for query execution. dbExpression will open the connection if it isn't already open, and will honor a transaction if one has been started on an open connection.
- commandTimeout
- – The execution duration (in seconds) of a query before execution will timeout if not yet complete.
- read
- – A delegate that enables you to take full control of the data reader returned from execution. Invocations using this parameter DO NOT have a method return.
- map
- – A delegate that enables you to take control of the mapping of rowset data. Invocations using this parameter return value(s), you specify what it returns by the generic parameter `T`.
- cancellationToken
- – dbExpression will check at each stage of the execution pipeline workflow and throw an exception if the token has been cancelled.
syntax examples