Interface IDalImplementor
数据访问器实现接口
Namespace: DapperDal.Implementor
Assembly: DapperDal.dll
Syntax
public interface IDalImplementor
Properties
| Improve this Doc View SourceSqlGenerator
SQL生成器
Declaration
ISqlGenerator SqlGenerator { get; }
Property Value
Type | Description |
---|---|
ISqlGenerator |
Methods
| Improve this Doc View SourceCount<T>(IDbConnection, Object, IDbTransaction, Nullable<Int32>)
根据条件获取实体条数
Declaration
int Count<T>(IDbConnection connection, object predicate, IDbTransaction transaction, int ? commandTimeout)where T : class
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
System.Object | predicate | 查询条件 |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
Returns
Type | Description |
---|---|
System.Int32 | 实体条数 |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |
Delete<T>(IDbConnection, T, IDbTransaction, Nullable<Int32>)
删除指定实体
Declaration
bool Delete<T>(IDbConnection connection, T entity, IDbTransaction transaction, int ? commandTimeout)where T : class
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
T | entity | 实体 |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
Returns
Type | Description |
---|---|
System.Boolean | 返回删除是否成功的结果 |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |
Delete<T>(IDbConnection, Object, IDbTransaction, Nullable<Int32>)
根据条件删除实体
Declaration
bool Delete<T>(IDbConnection connection, object predicate, IDbTransaction transaction, int ? commandTimeout)where T : class
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
System.Object | predicate | 删除条件 |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
Returns
Type | Description |
---|---|
System.Boolean | 返回删除是否成功的结果 |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |
Get<T>(IDbConnection, Object, IDbTransaction, Nullable<Int32>)
根据实体ID(主键)获取实体
Declaration
T Get<T>(IDbConnection connection, dynamic id, IDbTransaction transaction, int ? commandTimeout)where T : class
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
System.Object | id | 实体ID(主键) |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
Returns
Type | Description |
---|---|
T | 返回实体 |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |
GetIdPredicate(IClassMapper, Object)
根据实体主键ID获取谓词组
Declaration
IPredicate GetIdPredicate(IClassMapper classMap, object id)
Parameters
Type | Name | Description |
---|---|---|
IClassMapper | classMap | 实体类型映射 |
System.Object | id | 实体主键ID |
Returns
Type | Description |
---|---|
IPredicate | 谓词组 |
GetIdPredicate<T>(Object)
获取实体主键ID条件谓词
Declaration
IPredicate GetIdPredicate<T>(object id)where T : class
Parameters
Type | Name | Description |
---|---|---|
System.Object | id | 实体主键ID |
Returns
Type | Description |
---|---|
IPredicate | 谓词 |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |
GetList<T>(IDbConnection, Object, IList<ISort>, IDbTransaction, Nullable<Int32>, Boolean)
根据查询条件和排序条件获取实体集合
Declaration
IEnumerable<T> GetList<T>(IDbConnection connection, object predicate, IList<ISort> sort, IDbTransaction transaction, int ? commandTimeout, bool buffered)where T : class
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
System.Object | predicate | 查询条件 |
IList<ISort> | sort | 排序条件 |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
System.Boolean | buffered | 实体集合返回前是否要缓冲(ToList) |
Returns
Type | Description |
---|---|
IEnumerable<T> | 实体集合 |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |
GetMultiple(IDbConnection, GetMultiplePredicate, IDbTransaction, Nullable<Int32>)
根据多个条件组获取多个指定实体集合
Declaration
IMultipleResultReader GetMultiple(IDbConnection connection, GetMultiplePredicate predicate, IDbTransaction transaction, int ? commandTimeout)
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
GetMultiplePredicate | predicate | 查询条件 |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
Returns
Type | Description |
---|---|
IMultipleResultReader | 多实体集合读取器 |
GetPage<T>(IDbConnection, Object, IList<ISort>, Int32, Int32, IDbTransaction, Nullable<Int32>, Boolean)
根据查询条件和排序条件获取实体分页集合
Declaration
IEnumerable<T> GetPage<T>(IDbConnection connection, object predicate, IList<ISort> sort, int page, int resultsPerPage, IDbTransaction transaction, int ? commandTimeout, bool buffered)where T : class
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
System.Object | predicate | 查询条件 |
IList<ISort> | sort | 排序条件 |
System.Int32 | page | 页索引,从0起始 |
System.Int32 | resultsPerPage | 每页条数 |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
System.Boolean | buffered | 实体集合返回前是否要缓冲(ToList) |
Returns
Type | Description |
---|---|
IEnumerable<T> | 实体集合 |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |
GetSet<T>(IDbConnection, Object, IList<ISort>, Int32, Int32, IDbTransaction, Nullable<Int32>, Boolean)
根据查询条件和排序条件获取实体区间集合
Declaration
IEnumerable<T> GetSet<T>(IDbConnection connection, object predicate, IList<ISort> sort, int firstResult, int maxResults, IDbTransaction transaction, int ? commandTimeout, bool buffered)where T : class
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
System.Object | predicate | 查询条件 |
IList<ISort> | sort | 排序条件 |
System.Int32 | firstResult | 起始行数 |
System.Int32 | maxResults | 最大条数 |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
System.Boolean | buffered | 实体集合返回前是否要缓冲(ToList) |
Returns
Type | Description |
---|---|
IEnumerable<T> | 实体集合 |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |
GetTop<T>(IDbConnection, Int32, Object, IList<ISort>, IDbTransaction, Nullable<Int32>, Boolean)
根据查询条件和排序条件获取实体集合的前N条
Declaration
IEnumerable<T> GetTop<T>(IDbConnection connection, int limit, object predicate, IList<ISort> sort, IDbTransaction transaction, int ? commandTimeout, bool buffered)where T : class
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
System.Int32 | limit | 前几条 |
System.Object | predicate | 查询条件 |
IList<ISort> | sort | 排序条件 |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
System.Boolean | buffered | 实体集合返回前是否要缓冲(ToList) |
Returns
Type | Description |
---|---|
IEnumerable<T> | 实体集合 |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |
Insert<T>(IDbConnection, T, IDbTransaction, Nullable<Int32>)
插入指定实体
Declaration
dynamic Insert<T>(IDbConnection connection, T entity, IDbTransaction transaction, int ? commandTimeout)where T : class
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
T | entity | 实体 |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
Returns
Type | Description |
---|---|
System.Object | 返回插入实体ID(主键) |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |
Insert<T>(IDbConnection, IEnumerable<T>, IDbTransaction, Nullable<Int32>)
批量插入指定实体集合
Declaration
void Insert<T>(IDbConnection connection, IEnumerable<T> entities, IDbTransaction transaction, int ? commandTimeout)where T : class
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
IEnumerable<T> | entities | 实体集合 |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |
Update<T>(IDbConnection, T, IDbTransaction, Nullable<Int32>)
更新指定实体
Declaration
bool Update<T>(IDbConnection connection, T entity, IDbTransaction transaction, int ? commandTimeout)where T : class
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
T | entity | 实体 |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
Returns
Type | Description |
---|---|
System.Boolean | 返回更新是否成功的结果 |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |
Update<T>(IDbConnection, T, IList<String>, IDbTransaction, Nullable<Int32>)
更新指定实体指定属性
Declaration
bool Update<T>(IDbConnection connection, T entity, IList<string> props, IDbTransaction transaction, int ? commandTimeout)where T : class
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
T | entity | 实体 |
IList<System.String> | props | 要更新的属性名列表 |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
Returns
Type | Description |
---|---|
System.Boolean | 返回更新是否成功的结果 |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |
Update<T>(IDbConnection, T, Object, IDbTransaction, Nullable<Int32>)
更新指定实体指定属性
Declaration
bool Update<T>(IDbConnection connection, T entity, object props, IDbTransaction transaction, int ? commandTimeout)where T : class
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
T | entity | 实体 |
System.Object | props | 要更新的属性名列表,以匿名对象提供 |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
Returns
Type | Description |
---|---|
System.Boolean | 返回更新是否成功的结果 |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |
Update<T>(IDbConnection, Object, IDbTransaction, Nullable<Int32>)
根据指定指定主键ID更新实体指定属性
Declaration
bool Update<T>(IDbConnection connection, object keyAndProps, IDbTransaction transaction, int ? commandTimeout)where T : class
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
System.Object | keyAndProps | 更新实体,包含主键ID、更新属性及值 |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
Returns
Type | Description |
---|---|
System.Boolean | 返回更新是否成功的结果 |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |
Update<T>(IDbConnection, Object, Object, IDbTransaction, Nullable<Int32>)
根据指定更新条件更新实体指定属性
Declaration
bool Update<T>(IDbConnection connection, object props, object predicate, IDbTransaction transaction, int ? commandTimeout)where T : class
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | connection | 数据库连接 |
System.Object | props | 要更新的属性名及值,以匿名对象提供 |
System.Object | predicate | 更新条件,使用谓词或匿名对象 |
IDbTransaction | transaction | 数据库事务 |
System.Nullable<System.Int32> | commandTimeout | 数据库命令超时时间(单位秒) |
Returns
Type | Description |
---|---|
System.Boolean | 返回更新是否成功的结果 |
Type Parameters
Name | Description |
---|---|
T | 实体类型 |