Class SqlGeneratorImpl
SQL生成器类
Inheritance
System.Object
SqlGeneratorImpl
Namespace: DapperDal.Sql
Assembly: DapperDal.dll
Syntax
public class SqlGeneratorImpl : object, ISqlGenerator
Constructors
| Improve this Doc View SourceSqlGeneratorImpl(IDalConfiguration)
初始化SQL生成器类
Declaration
public SqlGeneratorImpl(IDalConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
IDalConfiguration | configuration | 数据访问配置类实例 |
Properties
| Improve this Doc View SourceConfiguration
数据访问配置类实例
Declaration
public IDalConfiguration Configuration { get; }
Property Value
Type | Description |
---|---|
IDalConfiguration |
Implements
Methods
| Improve this Doc View SourceBuildSelectColumns(IClassMapper)
生成所有字段组合语句
Declaration
public virtual string BuildSelectColumns(IClassMapper classMap)
Parameters
Type | Name | Description |
---|---|---|
IClassMapper | classMap | 实体类型映射 |
Returns
Type | Description |
---|---|
System.String | 字段组合语句 |
Count(IClassMapper, IPredicate, IDictionary<String, Object>)
生成条数获取语句
Declaration
public virtual string Count(IClassMapper classMap, IPredicate predicate, IDictionary<string, object> parameters)
Parameters
Type | Name | Description |
---|---|---|
IClassMapper | classMap | 实体类型映射 |
IPredicate | predicate | 查询条件谓词 |
IDictionary<System.String, System.Object> | parameters | 查询参数 |
Returns
Type | Description |
---|---|
System.String | 条数获取语句 |
Implements
| Improve this Doc View SourceDelete(IClassMapper, IPredicate, IDictionary<String, Object>)
生成删除语句
Declaration
public virtual string Delete(IClassMapper classMap, IPredicate predicate, IDictionary<string, object> parameters)
Parameters
Type | Name | Description |
---|---|---|
IClassMapper | classMap | 实体类型映射 |
IPredicate | predicate | 删除条件谓词 |
IDictionary<System.String, System.Object> | parameters | 删除参数 |
Returns
Type | Description |
---|---|
System.String | 删除语句 |
Implements
| Improve this Doc View SourceGetColumnName(IClassMapper, IPropertyMap, Boolean)
生成字段名
Declaration
public virtual string GetColumnName(IClassMapper map, IPropertyMap property, bool includeAlias)
Parameters
Type | Name | Description |
---|---|---|
IClassMapper | map | 实体类型映射 |
IPropertyMap | property | 属性映射 |
System.Boolean | includeAlias | 是否包含别名 |
Returns
Type | Description |
---|---|
System.String | 字段名 |
Implements
| Improve this Doc View SourceGetColumnName(IClassMapper, String, Boolean)
生成字段名
Declaration
public virtual string GetColumnName(IClassMapper map, string propertyName, bool includeAlias)
Parameters
Type | Name | Description |
---|---|---|
IClassMapper | map | 实体类型映射 |
System.String | propertyName | 属性名 |
System.Boolean | includeAlias | 是否包含别名 |
Returns
Type | Description |
---|---|
System.String | 字段名 |
Implements
| Improve this Doc View SourceGetTableName(IClassMapper)
生成表名
Declaration
public virtual string GetTableName(IClassMapper map)
Parameters
Type | Name | Description |
---|---|---|
IClassMapper | map | 实体类型映射 |
Returns
Type | Description |
---|---|
System.String |
Implements
| Improve this Doc View SourceIdentitySql(IClassMapper)
生成包含主键条件的获取语句
Declaration
public virtual string IdentitySql(IClassMapper classMap)
Parameters
Type | Name | Description |
---|---|---|
IClassMapper | classMap | 实体类型映射 |
Returns
Type | Description |
---|---|
System.String | 包含主键条件的获取语句 |
Implements
| Improve this Doc View SourceInsert(IClassMapper)
生成插入语句
Declaration
public virtual string Insert(IClassMapper classMap)
Parameters
Type | Name | Description |
---|---|---|
IClassMapper | classMap | 实体类型映射 |
Returns
Type | Description |
---|---|
System.String | 条数获取语句 |
Implements
| Improve this Doc View SourceSelect(IClassMapper, IPredicate, IList<ISort>, IDictionary<String, Object>, Int32)
生成获取语句
Declaration
public virtual string Select(IClassMapper classMap, IPredicate predicate, IList<ISort> sort, IDictionary<string, object> parameters, int limit = 0)
Parameters
Type | Name | Description |
---|---|---|
IClassMapper | classMap | 实体类型映射 |
IPredicate | predicate | 查询条件谓词 |
IList<ISort> | sort | 排序条件 |
IDictionary<System.String, System.Object> | parameters | 查询参数 |
System.Int32 | limit | 前几条 |
Returns
Type | Description |
---|---|
System.String | 生成获取语句 |
Implements
| Improve this Doc View SourceSelectPaged(IClassMapper, IPredicate, IList<ISort>, Int32, Int32, IDictionary<String, Object>)
生成分页获取语句
Declaration
public virtual string SelectPaged(IClassMapper classMap, IPredicate predicate, IList<ISort> sort, int page, int resultsPerPage, IDictionary<string, object> parameters)
Parameters
Type | Name | Description |
---|---|---|
IClassMapper | classMap | 实体类型映射 |
IPredicate | predicate | 查询条件谓词 |
IList<ISort> | sort | 排序条件 |
System.Int32 | page | 页索引 |
System.Int32 | resultsPerPage | 每页条数 |
IDictionary<System.String, System.Object> | parameters | 查询参数 |
Returns
Type | Description |
---|---|
System.String | 分页获取语句 |
Implements
| Improve this Doc View SourceSelectSet(IClassMapper, IPredicate, IList<ISort>, Int32, Int32, IDictionary<String, Object>)
生成区间获取语句
Declaration
public virtual string SelectSet(IClassMapper classMap, IPredicate predicate, IList<ISort> sort, int firstResult, int maxResults, IDictionary<string, object> parameters)
Parameters
Type | Name | Description |
---|---|---|
IClassMapper | classMap | 实体类型映射 |
IPredicate | predicate | 查询条件谓词 |
IList<ISort> | sort | 排序条件 |
System.Int32 | firstResult | 起始行数 |
System.Int32 | maxResults | 最大条数 |
IDictionary<System.String, System.Object> | parameters | 查询参数 |
Returns
Type | Description |
---|---|
System.String | 区间获取语句 |
Implements
| Improve this Doc View SourceSupportsMultipleStatements()
是否支持多语句执行
Declaration
public virtual bool SupportsMultipleStatements()
Returns
Type | Description |
---|---|
System.Boolean |
Implements
| Improve this Doc View SourceUpdate(IClassMapper, IPredicate, IDictionary<String, Object>, IList<String>)
生成更新语句
Declaration
public virtual string Update(IClassMapper classMap, IPredicate predicate, IDictionary<string, object> parameters, IList<string> props = null)
Parameters
Type | Name | Description |
---|---|---|
IClassMapper | classMap | 实体类型映射 |
IPredicate | predicate | 更新条件谓词 |
IDictionary<System.String, System.Object> | parameters | 更新参数 |
IList<System.String> | props | 更新属性列表 |
Returns
Type | Description |
---|---|
System.String | 更新语句 |