Appearance
ExecuteReaderAsync Method
Definition
- Namespace:
JASE.Database - Assembly:
JASE.Database.dll
Overloads
| Name | Description |
|---|---|
Task<Reader> ExecuteReaderAsync(ISqlStatement statement, bool doFirstRead = null, bool allowBatch = null, CommandType commandType = null, bool enableReaderTracking = null, int commandTimeout = null, CancellationToken cancellationToken = null) | Executes a database query asynchronously and returns a Reader to read the results. |
Task<Reader> ExecuteReaderAsync(string command, IReadOnlyList<IParameter> parameters = null, bool doFirstRead = null, bool allowBatch = null, CommandType commandType = null, bool enableReaderTracking = null, int commandTimeout = null, CancellationToken cancellationToken = null) | Executes a database query asynchronously and returns a Reader to read the results. |
Task<Reader> ExecuteReaderAsync(ISqlStatement statement, bool doFirstRead = null, bool allowBatch = null, CommandType commandType = null, bool enableReaderTracking = null, int commandTimeout = null, CancellationToken cancellationToken = null)
csharp
Task<Reader> ExecuteReaderAsync(ISqlStatement statement, bool doFirstRead = null, bool allowBatch = null, CommandType commandType = null, bool enableReaderTracking = null, int commandTimeout = null, CancellationToken cancellationToken = null)Executes a database query asynchronously and returns a Reader to read the results.
Parameters
| Name | Description |
|---|---|
allowBatch | If true, allows batch SQL statements; otherwise, throws if a batch is detected. |
cancellationToken | A token to cancel the operation. |
commandTimeout | The command timeout in seconds, or -1 to use the default. |
commandType | The type of command (e.g., Text, StoredProcedure). |
doFirstRead | If true, reads the first row of the result set asynchronously. |
enableReaderTracking | If , tracks the returned Reader instance so it can be managed and disposed by the connection/session lifecycle; otherwise, the caller is solely responsible for disposing the reader. |
statement | The prepared SQL statement to execute |
Returns
A Reader containing the query results.
Task<Reader> ExecuteReaderAsync(string command, IReadOnlyList<IParameter> parameters = null, bool doFirstRead = null, bool allowBatch = null, CommandType commandType = null, bool enableReaderTracking = null, int commandTimeout = null, CancellationToken cancellationToken = null)
csharp
Task<Reader> ExecuteReaderAsync(string command, IReadOnlyList<IParameter> parameters = null, bool doFirstRead = null, bool allowBatch = null, CommandType commandType = null, bool enableReaderTracking = null, int commandTimeout = null, CancellationToken cancellationToken = null)Executes a database query asynchronously and returns a Reader to read the results.
Parameters
| Name | Description |
|---|---|
allowBatch | If true, allows batch SQL statements; otherwise, throws if a batch is detected. |
cancellationToken | A token to cancel the operation. |
command | The SQL command or stored procedure name to execute. |
commandTimeout | The command timeout in seconds, or -1 to use the default. |
commandType | The type of command (e.g., Text, StoredProcedure). |
doFirstRead | If true, reads the first row of the result set asynchronously. |
enableReaderTracking | If , tracks the returned Reader instance so it can be managed and disposed by the connection/session lifecycle; otherwise, the caller is solely responsible for disposing the reader. |
parameters | The parameters to bind to the command, if any. |
Returns
A Reader containing the query results.
Remarks
When parameters is null and command is built from external input, callers must treat this as a trusted-SQL path (SQL injection risk). Prefer parameterized commands.