Show / Hide Table of Contents

Class DalImplementor

数据访问器默认实现类

Inheritance
System.Object
DalImplementor
Namespace: DapperDal.Implementor
Assembly: DapperDal.dll
Syntax
public class DalImplementor : object, IDalImplementor

Constructors

| Improve this Doc View Source

DalImplementor(ISqlGenerator)

初始化数据访问器

Declaration
public DalImplementor(ISqlGenerator sqlGenerator)
Parameters
Type Name Description
ISqlGenerator sqlGenerator

SQL生成器

Properties

| Improve this Doc View Source

SqlGenerator

SQL生成器

Declaration
public ISqlGenerator SqlGenerator { get; }
Property Value
Type Description
ISqlGenerator
Implements
IDalImplementor.SqlGenerator

Methods

| Improve this Doc View Source

Count<T>(IDbConnection, Object, IDbTransaction, Nullable<Int32>)

根据条件获取实体条数

Declaration
public 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

实体类型

Implements
IDalImplementor.Count<T>(IDbConnection, Object, IDbTransaction, Nullable<Int32>)
| Improve this Doc View Source

Delete<T>(IDbConnection, T, IDbTransaction, Nullable<Int32>)

Declaration
public 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
Implements
IDalImplementor.Delete<T>(IDbConnection, T, IDbTransaction, Nullable<Int32>)
| Improve this Doc View Source

Delete<T>(IDbConnection, IClassMapper, IPredicate, IDbTransaction, Nullable<Int32>)

根据条件删除实体

Declaration
protected bool Delete<T>(IDbConnection connection, IClassMapper classMap, IPredicate predicate, IDbTransaction transaction, int ? commandTimeout)where T : class
Parameters
Type Name Description
IDbConnection connection

数据库连接

IClassMapper classMap

实体类型映射

IPredicate predicate

删除条件

IDbTransaction transaction

数据库事务

System.Nullable<System.Int32> commandTimeout

数据库命令超时时间(单位秒)

Returns
Type Description
System.Boolean

返回删除是否成功的结果

Type Parameters
Name Description
T

实体类型

| Improve this Doc View Source

Delete<T>(IDbConnection, Object, IDbTransaction, Nullable<Int32>)

根据条件删除实体

Declaration
public 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

实体类型

Implements
IDalImplementor.Delete<T>(IDbConnection, Object, IDbTransaction, Nullable<Int32>)
| Improve this Doc View Source

Get<T>(IDbConnection, Object, IDbTransaction, Nullable<Int32>)

根据实体ID(主键)获取实体

Declaration
public 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

实体类型

Implements
IDalImplementor.Get<T>(IDbConnection, Object, IDbTransaction, Nullable<Int32>)
| Improve this Doc View Source

GetEntityPredicate(IClassMapper, Object)

根据实体获取谓词组

Declaration
protected IPredicate GetEntityPredicate(IClassMapper classMap, object entity)
Parameters
Type Name Description
IClassMapper classMap

实体类型映射

System.Object entity

实体

Returns
Type Description
IPredicate

谓词组

| Improve this Doc View Source

GetIdPredicate(IClassMapper, Object)

根据实体主键ID获取谓词组

Declaration
public IPredicate GetIdPredicate(IClassMapper classMap, object id)
Parameters
Type Name Description
IClassMapper classMap

实体类型映射

System.Object id

实体主键ID

Returns
Type Description
IPredicate

谓词组

Implements
IDalImplementor.GetIdPredicate(IClassMapper, Object)
| Improve this Doc View Source

GetIdPredicate<T>(Object)

获取实体主键ID条件谓词

Declaration
public 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

实体类型

Implements
IDalImplementor.GetIdPredicate<T>(Object)
| Improve this Doc View Source

GetKeyPredicate<T>(IClassMapper, T)

根据实体获取谓词组

Declaration
protected IPredicate GetKeyPredicate<T>(IClassMapper classMap, T entity)where T : class
Parameters
Type Name Description
IClassMapper classMap

实体类型映射

T entity

实体

Returns
Type Description
IPredicate

谓词组

Type Parameters
Name Description
T

实体类型

| Improve this Doc View Source

GetKeyPredicate<T>(IClassMapper, Object)

根据实体获取谓词组

Declaration
protected IPredicate GetKeyPredicate<T>(IClassMapper classMap, object entity)where T : class
Parameters
Type Name Description
IClassMapper classMap

实体类型映射

System.Object entity

实体

Returns
Type Description
IPredicate

谓词组

Type Parameters
Name Description
T

实体类型

| Improve this Doc View Source

GetList<T>(IDbConnection, IClassMapper, IPredicate, IList<ISort>, IDbTransaction, Nullable<Int32>, Boolean)

Declaration
protected IEnumerable<T> GetList<T>(IDbConnection connection, IClassMapper classMap, IPredicate predicate, IList<ISort> sort, IDbTransaction transaction, int ? commandTimeout, bool buffered)where T : class
Parameters
Type Name Description
IDbConnection connection
IClassMapper classMap
IPredicate predicate
IList<ISort> sort
IDbTransaction transaction
System.Nullable<System.Int32> commandTimeout
System.Boolean buffered
Returns
Type Description
IEnumerable<T>
Type Parameters
Name Description
T
| Improve this Doc View Source

GetList<T>(IDbConnection, IClassMapper, IPredicate, IList<ISort>, Int32, IDbTransaction, Nullable<Int32>, Boolean)

根据查询条件和排序条件获取实体集合

Declaration
protected IEnumerable<T> GetList<T>(IDbConnection connection, IClassMapper classMap, IPredicate predicate, IList<ISort> sort, int limit, IDbTransaction transaction, int ? commandTimeout, bool buffered)where T : class
Parameters
Type Name Description
IDbConnection connection

数据库连接

IClassMapper classMap

实体类型映射

IPredicate predicate

查询条件

IList<ISort> sort

排序条件

System.Int32 limit

前几条

IDbTransaction transaction

数据库事务

System.Nullable<System.Int32> commandTimeout

数据库命令超时时间(单位秒)

System.Boolean buffered

实体集合返回前是否要缓冲(ToList)

Returns
Type Description
IEnumerable<T>

实体集合

Type Parameters
Name Description
T

实体类型

| Improve this Doc View Source

GetList<T>(IDbConnection, Object, IList<ISort>, IDbTransaction, Nullable<Int32>, Boolean)

根据查询条件和排序条件获取实体集合

Declaration
public 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

实体类型

Implements
IDalImplementor.GetList<T>(IDbConnection, Object, IList<ISort>, IDbTransaction, Nullable<Int32>, Boolean)
| Improve this Doc View Source

GetMultiple(IDbConnection, GetMultiplePredicate, IDbTransaction, Nullable<Int32>)

根据多个条件组获取多个指定实体集合

Declaration
public 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

多实体集合读取器

Implements
IDalImplementor.GetMultiple(IDbConnection, GetMultiplePredicate, IDbTransaction, Nullable<Int32>)
| Improve this Doc View Source

GetMultipleByBatch(IDbConnection, GetMultiplePredicate, IDbTransaction, Nullable<Int32>)

根据多个条件组批量获取多个指定实体集合

Declaration
protected GridReaderResultReader GetMultipleByBatch(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
GridReaderResultReader

多实体集合读取器

| Improve this Doc View Source

GetMultipleBySequence(IDbConnection, GetMultiplePredicate, IDbTransaction, Nullable<Int32>)

根据多个条件组顺次获取多个指定实体集合

Declaration
protected SequenceReaderResultReader GetMultipleBySequence(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
SequenceReaderResultReader

多实体集合读取器

| Improve this Doc View Source

GetPage<T>(IDbConnection, IClassMapper, IPredicate, IList<ISort>, Int32, Int32, IDbTransaction, Nullable<Int32>, Boolean)

根据查询条件和排序条件获取实体分页集合

Declaration
protected IEnumerable<T> GetPage<T>(IDbConnection connection, IClassMapper classMap, IPredicate predicate, IList<ISort> sort, int page, int resultsPerPage, IDbTransaction transaction, int ? commandTimeout, bool buffered)where T : class
Parameters
Type Name Description
IDbConnection connection

数据库连接

IClassMapper classMap

实体类型映射

IPredicate 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

实体类型

| Improve this Doc View Source

GetPage<T>(IDbConnection, Object, IList<ISort>, Int32, Int32, IDbTransaction, Nullable<Int32>, Boolean)

根据查询条件和排序条件获取实体分页集合

Declaration
public 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

实体类型

Implements
IDalImplementor.GetPage<T>(IDbConnection, Object, IList<ISort>, Int32, Int32, IDbTransaction, Nullable<Int32>, Boolean)
| Improve this Doc View Source

GetPredicate(IClassMapper, Object)

根据实体对象获取谓词组

Declaration
protected IPredicate GetPredicate(IClassMapper classMap, object predicate)
Parameters
Type Name Description
IClassMapper classMap

实体类型映射

System.Object predicate

谓词表达式组,或实体对象

Returns
Type Description
IPredicate

谓词组

| Improve this Doc View Source

GetSet<T>(IDbConnection, IClassMapper, IPredicate, IList<ISort>, Int32, Int32, IDbTransaction, Nullable<Int32>, Boolean)

根据查询条件和排序条件获取实体区间集合

Declaration
protected IEnumerable<T> GetSet<T>(IDbConnection connection, IClassMapper classMap, IPredicate predicate, IList<ISort> sort, int firstResult, int maxResults, IDbTransaction transaction, int ? commandTimeout, bool buffered)where T : class
Parameters
Type Name Description
IDbConnection connection

数据库连接

IClassMapper classMap

实体类型映射

IPredicate 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

实体类型

| Improve this Doc View Source

GetSet<T>(IDbConnection, Object, IList<ISort>, Int32, Int32, IDbTransaction, Nullable<Int32>, Boolean)

根据查询条件和排序条件获取实体区间集合

Declaration
public 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

实体类型

Implements
IDalImplementor.GetSet<T>(IDbConnection, Object, IList<ISort>, Int32, Int32, IDbTransaction, Nullable<Int32>, Boolean)
| Improve this Doc View Source

GetTop<T>(IDbConnection, Int32, Object, IList<ISort>, IDbTransaction, Nullable<Int32>, Boolean)

根据查询条件和排序条件获取实体集合的前N条

Declaration
public 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

实体类型

Implements
IDalImplementor.GetTop<T>(IDbConnection, Int32, Object, IList<ISort>, IDbTransaction, Nullable<Int32>, Boolean)
| Improve this Doc View Source

Insert<T>(IDbConnection, T, IDbTransaction, Nullable<Int32>)

Declaration
public 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
Type Parameters
Name Description
T
Implements
IDalImplementor.Insert<T>(IDbConnection, T, IDbTransaction, Nullable<Int32>)
| Improve this Doc View Source

Insert<T>(IDbConnection, IEnumerable<T>, IDbTransaction, Nullable<Int32>)

Declaration
public 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
Implements
IDalImplementor.Insert<T>(IDbConnection, IEnumerable<T>, IDbTransaction, Nullable<Int32>)
| Improve this Doc View Source

Update<T>(IDbConnection, T, IDbTransaction, Nullable<Int32>)

Declaration
public 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
Implements
IDalImplementor.Update<T>(IDbConnection, T, IDbTransaction, Nullable<Int32>)
| Improve this Doc View Source

Update<T>(IDbConnection, T, IList<String>, IDbTransaction, Nullable<Int32>)

Declaration
public 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
Implements
IDalImplementor.Update<T>(IDbConnection, T, IList<String>, IDbTransaction, Nullable<Int32>)
| Improve this Doc View Source

Update<T>(IDbConnection, T, Object, IDbTransaction, Nullable<Int32>)

Declaration
public 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
Implements
IDalImplementor.Update<T>(IDbConnection, T, Object, IDbTransaction, Nullable<Int32>)
| Improve this Doc View Source

Update<T>(IDbConnection, Object, IDbTransaction, Nullable<Int32>)

根据指定指定主键ID更新实体指定属性

Declaration
public 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

实体类型

Implements
IDalImplementor.Update<T>(IDbConnection, Object, IDbTransaction, Nullable<Int32>)
| Improve this Doc View Source

Update<T>(IDbConnection, Object, Object, IDbTransaction, Nullable<Int32>)

根据指定更新条件更新实体指定属性

Declaration
public 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

实体类型

Implements
IDalImplementor.Update<T>(IDbConnection, Object, Object, IDbTransaction, Nullable<Int32>)

Extension Methods

SortingExtensions.ToSortable(Object)
  • Improve this Doc
  • View Source
Back to top Copyright © 2015-2017 Microsoft
Generated by DocFX