C# Class NLite.Data.Schema.Script.Generator.DatabaseScriptGenerator

数据库脚本生成器,提供数据库、表、主键约束、外键约束、检查约束、Uniqule约束等脚本的创建工作
Inheritance: IDatabaseScriptGenerator
Mostra file Open project: netcasewqs/elinq

Public Methods

Method Description
Build ( IDialect dialect, Mapping mappings, string databaseName ) : DatabaseScriptEntry

生成数据库脚本

DatabaseScriptGenerator ( ) : System
GetDbType ( SqlType sqlType ) : string

得到对应的数据库类型

Protected Methods

Method Description
BuildCheckConstraintScript ( IMemberMapping member ) : string

构建特定映射对应的检查约束脚本

BuildDatabaseScript ( string databaseName ) : string

构建数据库脚本

BuildFKScript ( IMemberMapping member ) : string

构建特定映射对应的外键脚本

BuildPKScript ( IMemberMapping members ) : string

构建特定映射对应的主键脚本

BuildSchemaScript ( IEntityMapping mappings ) : string[]

构建Schema脚本

BuildSequenceScript ( Mapping mapping ) : string

构建序列脚本

BuildTableScript ( IEntityMapping mapping ) : string

构建建表脚本

BuildUniquleConstraintScript ( IMemberMapping member ) : string

构建特定映射对应的唯一性约束脚本

GetDefaultValue ( IMemberMapping f, SqlType sqlType ) : string

得到缺省值

GetTableName ( IEntityMapping mapping ) : string

得到表名

RegisterColumnType ( DBType code, int size, string name ) : void
RegisterColumnType ( DBType code, string name ) : void
RegisterColumnTypes ( ) : void

Private Methods

Method Description
BuildAllSequanceScripts ( IEntityMapping Mappings ) : string[]
BuildColumn ( StringBuilder sb, IMemberMapping f ) : void

Method Details

Build() public method

生成数据库脚本
public Build ( IDialect dialect, Mapping mappings, string databaseName ) : DatabaseScriptEntry
dialect IDialect 数据库方言
mappings Mapping 映射元数据
databaseName string
return DatabaseScriptEntry

BuildCheckConstraintScript() protected method

构建特定映射对应的检查约束脚本
protected BuildCheckConstraintScript ( IMemberMapping member ) : string
member IMemberMapping
return string

BuildDatabaseScript() protected method

构建数据库脚本
protected BuildDatabaseScript ( string databaseName ) : string
databaseName string
return string

BuildFKScript() protected method

构建特定映射对应的外键脚本
protected BuildFKScript ( IMemberMapping member ) : string
member IMemberMapping
return string

BuildPKScript() protected method

构建特定映射对应的主键脚本
protected BuildPKScript ( IMemberMapping members ) : string
members IMemberMapping
return string

BuildSchemaScript() protected method

构建Schema脚本
protected BuildSchemaScript ( IEntityMapping mappings ) : string[]
mappings IEntityMapping
return string[]

BuildSequenceScript() protected method

构建序列脚本
protected BuildSequenceScript ( Mapping mapping ) : string
mapping Mapping
return string

BuildTableScript() protected method

构建建表脚本
protected BuildTableScript ( IEntityMapping mapping ) : string
mapping IEntityMapping
return string

BuildUniquleConstraintScript() protected method

构建特定映射对应的唯一性约束脚本
protected BuildUniquleConstraintScript ( IMemberMapping member ) : string
member IMemberMapping
return string

DatabaseScriptGenerator() public method

public DatabaseScriptGenerator ( ) : System
return System

GetDbType() public method

得到对应的数据库类型
public GetDbType ( SqlType sqlType ) : string
sqlType NLite.Data.Common.SqlType
return string

GetDefaultValue() protected method

得到缺省值
protected GetDefaultValue ( IMemberMapping f, SqlType sqlType ) : string
f IMemberMapping
sqlType NLite.Data.Common.SqlType
return string

GetTableName() protected method

得到表名
protected GetTableName ( IEntityMapping mapping ) : string
mapping IEntityMapping
return string

RegisterColumnType() protected method

protected RegisterColumnType ( DBType code, int size, string name ) : void
code DBType
size int
name string
return void

RegisterColumnType() protected method

protected RegisterColumnType ( DBType code, string name ) : void
code DBType
name string
return void

RegisterColumnTypes() protected method

protected RegisterColumnTypes ( ) : void
return void