C# Class FrameDAL.Dialect.BaseDialect

Author: Vincent Lau. 数据库方言类的基类,此类实现了一些通用的方法,通过此类获得的SQL具有跨数据的特性, 因为无法确定所使用的数据库,所以此类只能生成一些通用的SQL,若想针对不同的数据库进行 定制与优化,应写一个具体的方言类继承此类或直接实现IDialect接口。
Inheritance: IDialect
显示文件 Open project: vincentlauvlwj/FrameDAL

Public Methods

Method Description
GetAddRelationSql ( PropertyInfo manyToManyProp ) : string
GetCascadeDeleteSql ( PropertyInfo oneToManyProp ) : string
GetCheckExistSql ( Type type ) : string
GetDeleteItemSql ( PropertyInfo oneToManyProp, int countLeft ) : string
GetDeleteRelationsSql ( PropertyInfo manyToManyProp ) : string
GetDeleteSql ( Type type ) : string

获得实体类对应的delete sql

GetGeneratedKeySql ( string seqName ) : string

获得一条SQL,该SQL从数据库中查询最近一次插入操作生成的主键,此方法由子类实现

GetInsertSql ( Type type ) : string

获得实体类对应的表的insert sql

GetLoadColumnPropertySql ( PropertyInfo prop ) : string
GetLoadManyToManyPropertySql ( PropertyInfo prop, bool enableLazy, string>.Dictionary &resultMap ) : string
GetLoadManyToOnePropertySql ( PropertyInfo prop, bool enableLazy, string>.Dictionary &resultMap ) : string
GetLoadOneToManyPropertySql ( PropertyInfo prop, bool enableLazy, string>.Dictionary &resultMap ) : string
GetPagingSql ( string sqlText, int firstResult, int pageSize ) : string

执行查询之前,对SQL命令进行预处理,此方法由子类实现

GetSelectSql ( Type type, bool enableLazy, string>.Dictionary &resultMap, string where = null ) : string

获得实体类对应的select sql

GetUpdateForeignKeySql ( PropertyInfo oneToManyProp, int countLeft ) : string
GetUpdateSql ( Type type ) : string

获得实体类对应的update sql

Protected Methods

Method Description
AppendSelectedColumns ( StringBuilder sb, Type type, bool enableLazy, string>.Dictionary resultMap, string prefix ) : void

Private Methods

Method Description
GetSelectFromPart ( PropertyInfo prop, string>.Dictionary resultMap, bool flag ) : string

Method Details

AppendSelectedColumns() protected method

protected AppendSelectedColumns ( StringBuilder sb, Type type, bool enableLazy, string>.Dictionary resultMap, string prefix ) : void
sb StringBuilder
type System.Type
enableLazy bool
resultMap string>.Dictionary
prefix string
return void

GetAddRelationSql() public method

public GetAddRelationSql ( PropertyInfo manyToManyProp ) : string
manyToManyProp System.Reflection.PropertyInfo
return string

GetCascadeDeleteSql() public method

public GetCascadeDeleteSql ( PropertyInfo oneToManyProp ) : string
oneToManyProp System.Reflection.PropertyInfo
return string

GetCheckExistSql() public method

public GetCheckExistSql ( Type type ) : string
type System.Type
return string

GetDeleteItemSql() public method

public GetDeleteItemSql ( PropertyInfo oneToManyProp, int countLeft ) : string
oneToManyProp System.Reflection.PropertyInfo
countLeft int
return string

GetDeleteRelationsSql() public method

public GetDeleteRelationsSql ( PropertyInfo manyToManyProp ) : string
manyToManyProp System.Reflection.PropertyInfo
return string

GetDeleteSql() public method

获得实体类对应的delete sql
type为null 该类没有添加Table特性,或者Table.Name属性为空或空白字符串
public GetDeleteSql ( Type type ) : string
type System.Type 实体类
return string

GetGeneratedKeySql() public abstract method

获得一条SQL,该SQL从数据库中查询最近一次插入操作生成的主键,此方法由子类实现
public abstract GetGeneratedKeySql ( string seqName ) : string
seqName string 生成主键的序列,如果此方法的实现不需要此参数,可忽略
return string

GetInsertSql() public method

获得实体类对应的表的insert sql
type为null 该类没有添加Table特性,或者Table.Name属性为空或空白字符串 该类中没有任何公开属性
public GetInsertSql ( Type type ) : string
type System.Type 实体类
return string

GetLoadColumnPropertySql() public method

public GetLoadColumnPropertySql ( PropertyInfo prop ) : string
prop System.Reflection.PropertyInfo
return string

GetLoadManyToManyPropertySql() public method

public GetLoadManyToManyPropertySql ( PropertyInfo prop, bool enableLazy, string>.Dictionary &resultMap ) : string
prop System.Reflection.PropertyInfo
enableLazy bool
resultMap string>.Dictionary
return string

GetLoadManyToOnePropertySql() public method

public GetLoadManyToOnePropertySql ( PropertyInfo prop, bool enableLazy, string>.Dictionary &resultMap ) : string
prop System.Reflection.PropertyInfo
enableLazy bool
resultMap string>.Dictionary
return string

GetLoadOneToManyPropertySql() public method

public GetLoadOneToManyPropertySql ( PropertyInfo prop, bool enableLazy, string>.Dictionary &resultMap ) : string
prop System.Reflection.PropertyInfo
enableLazy bool
resultMap string>.Dictionary
return string

GetPagingSql() public abstract method

执行查询之前,对SQL命令进行预处理,此方法由子类实现
public abstract GetPagingSql ( string sqlText, int firstResult, int pageSize ) : string
sqlText string 要进行预处理的SQL
firstResult int 要返回的第一条结果的索引,该索引从0开始
pageSize int 返回的结果数量,若为0,则返回所有结果,不进行分页查询
return string

GetSelectSql() public method

获得实体类对应的select sql
type为null 实体类映射错误
public GetSelectSql ( Type type, bool enableLazy, string>.Dictionary &resultMap, string where = null ) : string
type System.Type 实体类
enableLazy bool
resultMap string>.Dictionary
where string
return string

GetUpdateForeignKeySql() public method

public GetUpdateForeignKeySql ( PropertyInfo oneToManyProp, int countLeft ) : string
oneToManyProp System.Reflection.PropertyInfo
countLeft int
return string

GetUpdateSql() public method

获得实体类对应的update sql
type为null 实体类映射错误
public GetUpdateSql ( Type type ) : string
type System.Type 实体类
return string