C# Класс NMigrations.Sql.GenericSqlProvider

A general SQL generator implementation that implements the aspects that are common to all SQL dialects. Differences in SQL dialects are applied by subclassing GenericSqlProvider and overriding the specific methods.
Наследование: ISqlProvider
Показать файл Открыть проект

Открытые методы

Метод Описание
GenerateSqlCommands ( Database database ) : IEnumerable

Generates the SQL commands for the specified database.

GetDefaultConstraintName ( string tableName, string columnName ) : string

Builds the name for a default constraint.

GetForeignKeyConstraintName ( string tableName, string columnNames, string relatedTableName, string relatedColumnNames ) : string

Builds the name for a foreign key constraint.

GetIndexName ( string tableName, string columnNames ) : string

Builds the name for an index.

GetPrimaryKeyConstraintName ( string tableName, string columnNames ) : string

Builds the name for a primary key constraint.

GetQuerySeparator ( ) : string

Gets the SQL command that separates multiple SQL queries in one SQL script file of each other.

GetUniqueConstraintName ( string tableName, string columnNames ) : string

Builds the name for a unique constraint.

Защищенные методы

Метод Описание
AddDefaultConstraint ( DefaultConstraint defaultConstraint ) : IEnumerable

Enumerates the SQL commands that are necessary to create the specified defaultConstraint.

AddForeignKeyConstraint ( ForeignKeyConstraint fk ) : IEnumerable

Enumerates the SQL commands that are necessary to create the specified foreign key constraint (fk).

AddPrimaryKeyConstraint ( PrimaryKeyConstraint pk ) : IEnumerable

Enumerates the SQL commands that are necessary to create the specified primary key constraint (pk).

AddUniqueConstraint ( UniqueConstraint uniqueConstraint ) : IEnumerable

Enumerates the SQL commands that are necessary to create the specified uniqueConstraint.

AlterTable ( Table table ) : IEnumerable

Enumerates the SQL commands that are necessary to alter the specified table.

BuildAddColumn ( Column column ) : IEnumerable

Builds the SQL commands that adds the specified Column to its table.

BuildAlterColumnProperties ( Column column ) : IEnumerable

Builds the SQL commands that change the specified column's data type.

BuildAutoIncrement ( int seed, int step ) : string

Builds the SQL fragment that describes an auto-increment column.

BuildCreateTableColumn ( Column column ) : string

Builds the SQL fragment that describes a column in a CREATE TABLE statement.

BuildCreateTableConstraints ( Table table ) : IEnumerable

Builds the SQL fragments that follow after the column list in the CREATE TABLE statement (like constraints or indices).

BuildCreateTableForeignKeyConstraint ( ForeignKeyConstraint fk ) : string

Builds the SQL fragment that describes a foreign key constraint within a CREATE TABLE statement.

BuildCreateTablePrimaryKeyConstraint ( PrimaryKeyConstraint pk ) : string

Builds the SQL fragment that describes a primary key constraint within a CREATE TABLE statement.

BuildCreateTableUniqueConstraint ( UniqueConstraint uniqueConstraint ) : string

Builds the SQL fragment that describes a unqiue constraint within a CREATE TABLE statement.

BuildDataType ( SqlTypes type, int length, int scale, int precision ) : string

Builds the String that represents the specified type.

BuildDropColumn ( Column column ) : IEnumerable

Builds the SQL commands that drops the specified column from its table.

BuildDropDefault ( Column column ) : IEnumerable

Builds the SQL commands that drops the default value for the specified column.

BuildRenameColumn ( Column column ) : IEnumerable

Builds the SQL commands that renames the specified column.

CreateIndex ( System.Data.Common.Index index ) : IEnumerable

Enumerates the SQL commands that are necessary to create the specified index.

CreateTable ( Table table ) : IEnumerable

Enumerates the SQL commands that are necessary to create the specified table.

DropConstraint ( Constraint constraint ) : IEnumerable

Enumerates the SQL commands that are necessary to drop the specified constraint.

DropDefaultConstraint ( DefaultConstraint defaultConstraint ) : IEnumerable

Enumerates the SQL commands that are necessary to drop the specified defaultConstraint.

DropForeignKeyConstraint ( ForeignKeyConstraint fk ) : IEnumerable

Enumerates the SQL commands that are necessary to drop the specified foreign key constraint (fk).

DropIndex ( System.Data.Common.Index index ) : IEnumerable

Enumerates the SQL commands that are necessary to drop the specified index.

DropPrimaryKeyConstraint ( PrimaryKeyConstraint pk ) : IEnumerable

Enumerates the SQL commands that are necessary to drop the specified primary key constraint (pk).

DropTable ( Table table ) : IEnumerable

Enumerates the SQL commands that are necessary to drop the specified table.

DropUniqueConstraint ( UniqueConstraint uniqueConstraint ) : IEnumerable

Enumerates the SQL commands that are necessary to drop the specified uniqueConstraint.

EscapeColumnName ( string columnName ) : string

Escapes the specified columnName.

EscapeColumnNames ( string columnNames ) : string[]

Applies the EscapeColumnName method to an array of column names.

EscapeConstraintName ( string constraintName ) : string

Escapes the specified constraintName.

EscapeString ( string value ) : string

Escapes the specified string value that it can be surrounded by StringQuotes and used in a SQL query.

EscapeTableName ( string tableName ) : string

Escapes the specified tableName

ExecuteSqlStatement ( SqlStatement sql ) : IEnumerable

Enumerates the SQL commands that are necessary to execute the specified sql statement.

FormatValue ( object value ) : string

Formats the specified value according the described data type that it can be used in a SQL statement.

Insert ( Insert insert ) : IEnumerable

Generates the SQL statements that inserts the row described by the specified insert object into the database.

Update ( Update update ) : IEnumerable

Generates the SQL statements that updates rows described by the specified update object.

Описание методов

AddDefaultConstraint() защищенный Метод

Enumerates the SQL commands that are necessary to create the specified defaultConstraint.
protected AddDefaultConstraint ( DefaultConstraint defaultConstraint ) : IEnumerable
defaultConstraint DefaultConstraint The default constraint.
Результат IEnumerable

AddForeignKeyConstraint() защищенный Метод

Enumerates the SQL commands that are necessary to create the specified foreign key constraint (fk).
protected AddForeignKeyConstraint ( ForeignKeyConstraint fk ) : IEnumerable
fk ForeignKeyConstraint The foreign key constraint.
Результат IEnumerable

AddPrimaryKeyConstraint() защищенный Метод

Enumerates the SQL commands that are necessary to create the specified primary key constraint (pk).
protected AddPrimaryKeyConstraint ( PrimaryKeyConstraint pk ) : IEnumerable
pk PrimaryKeyConstraint The primary key constraint.
Результат IEnumerable

AddUniqueConstraint() защищенный Метод

Enumerates the SQL commands that are necessary to create the specified uniqueConstraint.
protected AddUniqueConstraint ( UniqueConstraint uniqueConstraint ) : IEnumerable
uniqueConstraint UniqueConstraint The unique constraint.
Результат IEnumerable

AlterTable() защищенный Метод

Enumerates the SQL commands that are necessary to alter the specified table.
protected AlterTable ( Table table ) : IEnumerable
table Table The table to alter.
Результат IEnumerable

BuildAddColumn() защищенный Метод

Builds the SQL commands that adds the specified Column to its table.
protected BuildAddColumn ( Column column ) : IEnumerable
column Column The column.
Результат IEnumerable

BuildAlterColumnProperties() защищенный Метод

Builds the SQL commands that change the specified column's data type.
protected BuildAlterColumnProperties ( Column column ) : IEnumerable
column Column The column.
Результат IEnumerable

BuildAutoIncrement() защищенный абстрактный Метод

Builds the SQL fragment that describes an auto-increment column.
protected abstract BuildAutoIncrement ( int seed, int step ) : string
seed int The initial value.
step int The increment step.
Результат string

BuildCreateTableColumn() защищенный Метод

Builds the SQL fragment that describes a column in a CREATE TABLE statement.
protected BuildCreateTableColumn ( Column column ) : string
column Column The column.
Результат string

BuildCreateTableConstraints() защищенный Метод

Builds the SQL fragments that follow after the column list in the CREATE TABLE statement (like constraints or indices).
protected BuildCreateTableConstraints ( Table table ) : IEnumerable
table Table The table.
Результат IEnumerable

BuildCreateTableForeignKeyConstraint() защищенный Метод

Builds the SQL fragment that describes a foreign key constraint within a CREATE TABLE statement.
protected BuildCreateTableForeignKeyConstraint ( ForeignKeyConstraint fk ) : string
fk ForeignKeyConstraint The foreign key constraint.
Результат string

BuildCreateTablePrimaryKeyConstraint() защищенный Метод

Builds the SQL fragment that describes a primary key constraint within a CREATE TABLE statement.
protected BuildCreateTablePrimaryKeyConstraint ( PrimaryKeyConstraint pk ) : string
pk PrimaryKeyConstraint The primary key constraint.
Результат string

BuildCreateTableUniqueConstraint() защищенный Метод

Builds the SQL fragment that describes a unqiue constraint within a CREATE TABLE statement.
protected BuildCreateTableUniqueConstraint ( UniqueConstraint uniqueConstraint ) : string
uniqueConstraint UniqueConstraint The unique constraint.
Результат string

BuildDataType() защищенный абстрактный Метод

Builds the String that represents the specified type.
protected abstract BuildDataType ( SqlTypes type, int length, int scale, int precision ) : string
type SqlTypes The type.
length int The length.
scale int The scale.
precision int The precision.
Результат string

BuildDropColumn() защищенный Метод

Builds the SQL commands that drops the specified column from its table.
protected BuildDropColumn ( Column column ) : IEnumerable
column Column The column.
Результат IEnumerable

BuildDropDefault() защищенный Метод

Builds the SQL commands that drops the default value for the specified column.
protected BuildDropDefault ( Column column ) : IEnumerable
column Column The column.
Результат IEnumerable

BuildRenameColumn() защищенный Метод

Builds the SQL commands that renames the specified column.
protected BuildRenameColumn ( Column column ) : IEnumerable
column Column The column.
Результат IEnumerable

CreateIndex() защищенный Метод

Enumerates the SQL commands that are necessary to create the specified index.
protected CreateIndex ( System.Data.Common.Index index ) : IEnumerable
index System.Data.Common.Index The index to create.
Результат IEnumerable

CreateTable() защищенный Метод

Enumerates the SQL commands that are necessary to create the specified table.
protected CreateTable ( Table table ) : IEnumerable
table Table The table to create.
Результат IEnumerable

DropConstraint() защищенный Метод

Enumerates the SQL commands that are necessary to drop the specified constraint.
protected DropConstraint ( Constraint constraint ) : IEnumerable
constraint Constraint The constraint to drop.
Результат IEnumerable

DropDefaultConstraint() защищенный Метод

Enumerates the SQL commands that are necessary to drop the specified defaultConstraint.
protected DropDefaultConstraint ( DefaultConstraint defaultConstraint ) : IEnumerable
defaultConstraint DefaultConstraint The default constraint.
Результат IEnumerable

DropForeignKeyConstraint() защищенный Метод

Enumerates the SQL commands that are necessary to drop the specified foreign key constraint (fk).
protected DropForeignKeyConstraint ( ForeignKeyConstraint fk ) : IEnumerable
fk ForeignKeyConstraint The foreign key constraint.
Результат IEnumerable

DropIndex() защищенный Метод

Enumerates the SQL commands that are necessary to drop the specified index.
protected DropIndex ( System.Data.Common.Index index ) : IEnumerable
index System.Data.Common.Index The index to drop.
Результат IEnumerable

DropPrimaryKeyConstraint() защищенный Метод

Enumerates the SQL commands that are necessary to drop the specified primary key constraint (pk).
protected DropPrimaryKeyConstraint ( PrimaryKeyConstraint pk ) : IEnumerable
pk PrimaryKeyConstraint The primary key constraint.
Результат IEnumerable

DropTable() защищенный Метод

Enumerates the SQL commands that are necessary to drop the specified table.
protected DropTable ( Table table ) : IEnumerable
table Table The table to drop.
Результат IEnumerable

DropUniqueConstraint() защищенный Метод

Enumerates the SQL commands that are necessary to drop the specified uniqueConstraint.
protected DropUniqueConstraint ( UniqueConstraint uniqueConstraint ) : IEnumerable
uniqueConstraint UniqueConstraint The unique constraint.
Результат IEnumerable

EscapeColumnName() защищенный абстрактный Метод

Escapes the specified columnName.
protected abstract EscapeColumnName ( string columnName ) : string
columnName string Name of the column.
Результат string

EscapeColumnNames() защищенный Метод

Applies the EscapeColumnName method to an array of column names.
protected EscapeColumnNames ( string columnNames ) : string[]
columnNames string The column names.
Результат string[]

EscapeConstraintName() защищенный абстрактный Метод

Escapes the specified constraintName.
protected abstract EscapeConstraintName ( string constraintName ) : string
constraintName string Name of the constraint.
Результат string

EscapeString() защищенный Метод

Escapes the specified string value that it can be surrounded by StringQuotes and used in a SQL query.
protected EscapeString ( string value ) : string
value string The string value to escape.
Результат string

EscapeTableName() защищенный абстрактный Метод

Escapes the specified tableName
protected abstract EscapeTableName ( string tableName ) : string
tableName string Name of the table.
Результат string

ExecuteSqlStatement() защищенный Метод

Enumerates the SQL commands that are necessary to execute the specified sql statement.
protected ExecuteSqlStatement ( SqlStatement sql ) : IEnumerable
sql SqlStatement The SQL statement.
Результат IEnumerable

FormatValue() защищенный Метод

Formats the specified value according the described data type that it can be used in a SQL statement.
protected FormatValue ( object value ) : string
value object The value.
Результат string

GenerateSqlCommands() публичный Метод

Generates the SQL commands for the specified database.
public GenerateSqlCommands ( Database database ) : IEnumerable
database Database The database.
Результат IEnumerable

GetDefaultConstraintName() публичный Метод

Builds the name for a default constraint.
public GetDefaultConstraintName ( string tableName, string columnName ) : string
tableName string Name of the table.
columnName string The column name.
Результат string

GetForeignKeyConstraintName() публичный Метод

Builds the name for a foreign key constraint.
public GetForeignKeyConstraintName ( string tableName, string columnNames, string relatedTableName, string relatedColumnNames ) : string
tableName string Name of the table.
columnNames string The column names.
relatedTableName string Name of the related table.
relatedColumnNames string The related column names.
Результат string

GetIndexName() публичный Метод

Builds the name for an index.
public GetIndexName ( string tableName, string columnNames ) : string
tableName string Name of the table.
columnNames string The column names.
Результат string

GetPrimaryKeyConstraintName() публичный Метод

Builds the name for a primary key constraint.
public GetPrimaryKeyConstraintName ( string tableName, string columnNames ) : string
tableName string Name of the table.
columnNames string The column names.
Результат string

GetQuerySeparator() публичный абстрактный Метод

Gets the SQL command that separates multiple SQL queries in one SQL script file of each other.
public abstract GetQuerySeparator ( ) : string
Результат string

GetUniqueConstraintName() публичный Метод

Builds the name for a unique constraint.
public GetUniqueConstraintName ( string tableName, string columnNames ) : string
tableName string Name of the table.
columnNames string The column names.
Результат string

Insert() защищенный Метод

Generates the SQL statements that inserts the row described by the specified insert object into the database.
protected Insert ( Insert insert ) : IEnumerable
insert Insert The insert containing the row to insert.
Результат IEnumerable

Update() защищенный Метод

Generates the SQL statements that updates rows described by the specified update object.
protected Update ( Update update ) : IEnumerable
update Update The update command.
Результат IEnumerable