DapperExecutor 类
Dapper执行器
public class DapperExecutor : IExecutor
- 继承
-
DapperExecutor
- 实现
- Derived
- 继承成员
- 扩展方法
构造函数
DapperExecutor(ISqlEngine, IDbConnection, bool, int)
Dapper执行器
public DapperExecutor(ISqlEngine engine, IDbConnection connection, bool buffered = true, int capacity = 128)
参数
engine
ISqlEngineconnection
IDbConnectionbuffered
boolcapacity
int
字段
_capacity
sql语句默认大小
protected readonly int _capacity
字段值
_engine
数据库引擎
protected readonly ISqlEngine _engine
字段值
属性
Buffered
Whether to buffer results in memory.
public bool Buffered { get; }
属性值
Capacity
sql语句默认大小
public int Capacity { get; }
属性值
CommandTimeout
Number of seconds before command execution timeout.
public int? CommandTimeout { get; set; }
属性值
- int?
Connection
数据库连接
public IDbConnection Connection { get; }
属性值
Engine
数据库引擎
public ISqlEngine Engine { get; }
属性值
Transaction
The transaction to use for this command.
public IDbTransaction? Transaction { get; }
属性值
方法
BeginTransaction()
开启事务
public void BeginTransaction()
BeginTransaction(IsolationLevel)
开启事务
public void BeginTransaction(IsolationLevel level)
参数
level
IsolationLevel
Commit()
提交事务
public void Commit()
CountAsync<T>(ITableView, object?)
异步计数
public virtual Task<T?> CountAsync<T>(ITableView view, object? param = null)
参数
view
ITableViewparam
object
返回
- Task<T>
类型参数
T
Count<T>(ITableView, object?)
计数
public virtual T? Count<T>(ITableView view, object? param = null)
参数
view
ITableViewparam
object
返回
- T
类型参数
T
Execute(ISqlEntity, object?)
执行
public virtual int Execute(ISqlEntity entity, object? param = null)
参数
entity
ISqlEntityparam
object
返回
Execute(string, object?)
Execute parameterized SQL.
public int Execute(string sql, object? param = null)
参数
返回
- int
The number of rows affected.
ExecuteAsync(ISqlEntity, object?)
异步执行
public virtual Task<int> ExecuteAsync(ISqlEntity entity, object? param = null)
参数
entity
ISqlEntityparam
object
返回
ExecuteAsync(string, object?)
Execute parameterized SQL.
public Task<int> ExecuteAsync(string sql, object? param = null)
参数
返回
ExecuteScalarAsync<T>(ISqlEntity, object?)
异步执行(返回一行一列)
public virtual Task<T?> ExecuteScalarAsync<T>(ISqlEntity entity, object? param = null)
参数
entity
ISqlEntityparam
object
返回
- Task<T>
类型参数
T
ExecuteScalarAsync<T>(string, object?)
Execute parameterized SQL that selects a single value.
public Task<T?> ExecuteScalarAsync<T>(string sql, object? param = null)
参数
返回
- Task<T>
The first cell returned, as
T
.
类型参数
T
The type to return.
ExecuteScalar<T>(ISqlEntity, object?)
执行(返回一行一列)
public virtual T? ExecuteScalar<T>(ISqlEntity entity, object? param = null)
参数
entity
ISqlEntityparam
object
返回
- T
类型参数
T
ExecuteScalar<T>(string, object?)
Execute parameterized SQL that selects a single value.
public T? ExecuteScalar<T>(string sql, object? param = null)
参数
返回
- T
The first cell returned, as
T
.
类型参数
T
The type to return.
QueryAsync<T>(ISqlEntity, object?)
Execute a query asynchronously using Task.
public virtual 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.
QueryAsync<T>(string, object?)
Execute a query asynchronously using Task.
public Task<IEnumerable<T>> QueryAsync<T>(string sql, object? param = null)
参数
返回
- Task<IEnumerable<T>>
类型参数
T
The type of results to return.
QueryFirstOrDefaultAsync<T>(ISqlEntity, object?)
Execute a single-row query asynchronously using Task.
public virtual 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.
QueryFirstOrDefaultAsync<T>(string, object?)
Execute a single-row query asynchronously using Task.
public Task<T?> QueryFirstOrDefaultAsync<T>(string sql, object? param = null)
参数
返回
- Task<T>
类型参数
T
The type of result to return.
QueryFirstOrDefault<T>(ISqlEntity, object?)
获取单条
public virtual T? QueryFirstOrDefault<T>(ISqlEntity entity, object? param = null)
参数
entity
ISqlEntityparam
object
返回
- T
类型参数
T
QueryFirstOrDefault<T>(string, object?)
Executes a single-row query, returning the data typed as T
.
public T? QueryFirstOrDefault<T>(string sql, object? param = null)
参数
返回
- 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?)
获取列表
public virtual IEnumerable<T> Query<T>(ISqlEntity entity, object? param = null)
参数
entity
ISqlEntityparam
object
返回
- IEnumerable<T>
类型参数
T
Query<T>(string, object?)
Executes a query, returning the data typed as T
.
public IEnumerable<T> Query<T>(string sql, object? param = null)
参数
返回
- 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.
Rollback()
回滚事务
public void Rollback()