IExecutor 接口
执行器
public interface IExecutor
- 扩展方法
方法
CountAsync<T>(ITableView, object?)
异步计数
Task<T?> CountAsync<T>(ITableView view, object? param = null)
参数
view
ITableViewparam
object
返回
- Task<T>
类型参数
T
Count<T>(ITableView, object?)
计数
T? Count<T>(ITableView view, object? param = null)
参数
view
ITableViewparam
object
返回
- T
类型参数
T
Execute(ISqlEntity, object?)
Execute parameterized SQL.
int Execute(ISqlEntity sql, object? param = null)
参数
sql
ISqlEntityThe SQL to execute for this query.
param
objectThe parameters to use for this query.
返回
- int
The number of rows affected.
ExecuteAsync(ISqlEntity, object?)
Execute parameterized SQL.
Task<int> ExecuteAsync(ISqlEntity entity, object? param = null)
参数
entity
ISqlEntityThe SQL to execute for this query.
param
objectThe parameters to use for this query.
返回
ExecuteScalarAsync<T>(ISqlEntity, object?)
Execute parameterized SQL that selects a single value.
Task<T?> ExecuteScalarAsync<T>(ISqlEntity entity, object? param = null)
参数
entity
ISqlEntityThe SQL to execute.
param
objectThe parameters to use for this command.
返回
- Task<T>
The first cell returned, as
T
.
类型参数
T
The type to return.
ExecuteScalar<T>(ISqlEntity, object?)
Execute parameterized SQL that selects a single value.
T? ExecuteScalar<T>(ISqlEntity entity, object? param = null)
参数
entity
ISqlEntityThe SQL to execute.
param
objectThe parameters to use for this command.
返回
- T
The first cell returned, as
T
.
类型参数
T
The type to return.
QueryAsync<T>(ISqlEntity, object?)
Execute a query asynchronously using Task.
Task<IEnumerable<T>> QueryAsync<T>(ISqlEntity entity, object? param = null)
参数
entity
ISqlEntityThe SQL to execute for the query.
param
objectThe parameters to pass, if any.
返回
- Task<IEnumerable<T>>
类型参数
T
The type of results to return.
QueryFirstOrDefaultAsync<T>(ISqlEntity, object?)
Execute a single-row query asynchronously using Task.
Task<T?> QueryFirstOrDefaultAsync<T>(ISqlEntity entity, object? param = null)
参数
entity
ISqlEntityThe SQL to execute for the query.
param
objectThe parameters to pass, if any.
返回
- Task<T>
类型参数
T
The type of result to return.
QueryFirstOrDefault<T>(ISqlEntity, object?)
Executes a single-row query, returning the data typed as T
.
T? QueryFirstOrDefault<T>(ISqlEntity entity, object? param = null)
参数
entity
ISqlEntityThe SQL to execute for the query.
param
objectThe parameters to pass, if any.
返回
- T
A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is created per row, and a direct column-name===member-name mapping is assumed (case insensitive).
类型参数
T
The type of result to return.
Query<T>(ISqlEntity, object?)
Executes a query, returning the data typed as T
.
IEnumerable<T> Query<T>(ISqlEntity entity, object? param = null)
参数
entity
ISqlEntityThe SQL to execute for the query.
param
objectThe parameters to pass, if any.
返回
- IEnumerable<T>
A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column is assumed, otherwise an instance is created per row, and a direct column-name===member-name mapping is assumed (case insensitive).
类型参数
T
The type of results to return.