SqlServerMigrationSqlGenerator SqlServerMigrationSqlGenerator SqlServerMigrationSqlGenerator Class

Definition

Provider to convert provider agnostic migration operations into SQL commands that can be run against a Microsoft SQL Server database.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
public class SqlServerMigrationSqlGenerator : System.Data.Entity.Migrations.Sql.MigrationSqlGenerator
type SqlServerMigrationSqlGenerator = class
    inherit MigrationSqlGenerator
Public Class SqlServerMigrationSqlGenerator
Inherits MigrationSqlGenerator
Inheritance
SqlServerMigrationSqlGeneratorSqlServerMigrationSqlGeneratorSqlServerMigrationSqlGenerator
Attributes

Constructors

SqlServerMigrationSqlGenerator() SqlServerMigrationSqlGenerator() SqlServerMigrationSqlGenerator()

Properties

GuidColumnDefault GuidColumnDefault GuidColumnDefault

Returns the column default value to use for store-generated GUID columns when no default value is explicitly specified in the migration. Returns newsequentialid() for on-premises SQL Server 2005 and later. Returns newid() for SQL Azure.

ProviderManifest ProviderManifest ProviderManifest

Gets or sets the provider manifest.

(Inherited from MigrationSqlGenerator)

Methods

BuildColumnType(ColumnModel) BuildColumnType(ColumnModel) BuildColumnType(ColumnModel)

Generates SQL to specify the data type of a column. This method just generates the actual type, not the SQL to create the column.

BuildStoreTypeUsage(String, PropertyModel) BuildStoreTypeUsage(String, PropertyModel) BuildStoreTypeUsage(String, PropertyModel)

Builds the store type usage for the specified storeTypeName using the facets from the specified propertyModel.

(Inherited from MigrationSqlGenerator)
CreateConnection() CreateConnection() CreateConnection()

Creates an empty connection for the current provider. Allows derived providers to use connection other than SqlConnection.

DropDefaultConstraint(String, String, IndentedTextWriter) DropDefaultConstraint(String, String, IndentedTextWriter) DropDefaultConstraint(String, String, IndentedTextWriter)

Call this method to generate SQL that will attempt to drop the default constraint created when a column is created. This method is usually called by code that overrides the creation or altering of columns.

Generate(AddColumnOperation) Generate(AddColumnOperation) Generate(AddColumnOperation)

Generates SQL for a AddColumnOperation. Generated SQL should be added using the Statement method.

Generate(AddForeignKeyOperation) Generate(AddForeignKeyOperation) Generate(AddForeignKeyOperation)

Generates SQL for a AddForeignKeyOperation. Generated SQL should be added using the Statement method.

Generate(AddPrimaryKeyOperation) Generate(AddPrimaryKeyOperation) Generate(AddPrimaryKeyOperation)

Generates SQL for a AddPrimaryKeyOperation. Generated SQL should be added using the Statement method.

Generate(AlterColumnOperation) Generate(AlterColumnOperation) Generate(AlterColumnOperation)

Generates SQL for a AlterColumnOperation. Generated SQL should be added using the Statement method.

Generate(AlterProcedureOperation) Generate(AlterProcedureOperation) Generate(AlterProcedureOperation)

Generates the specified alter procedure operation.

Generate(AlterTableOperation) Generate(AlterTableOperation) Generate(AlterTableOperation)

Override this method to generate SQL when the definition of a table or its attributes are changed. The default implementation of this method does nothing.

Generate(Boolean) Generate(Boolean) Generate(Boolean)

Generates SQL to specify a constant bool default value being set on a column. This method just generates the actual value, not the SQL to set the default value.

Generate(Byte[]) Generate(Byte[]) Generate(Byte[])

Generates SQL to specify a constant byte[] default value being set on a column. This method just generates the actual value, not the SQL to set the default value.

Generate(ColumnModel, IndentedTextWriter) Generate(ColumnModel, IndentedTextWriter) Generate(ColumnModel, IndentedTextWriter)

Generates SQL for the given column model. This method is called by other methods that process columns and can be overridden to change the SQL generated.

Generate(CreateIndexOperation) Generate(CreateIndexOperation) Generate(CreateIndexOperation)

Generates SQL for a CreateIndexOperation. Generated SQL should be added using the Statement method.

Generate(CreateProcedureOperation) Generate(CreateProcedureOperation) Generate(CreateProcedureOperation)

Generates the specified create procedure operation.

Generate(CreateTableOperation) Generate(CreateTableOperation) Generate(CreateTableOperation)

Generates SQL for a CreateTableOperation. This method differs from WriteCreateTable(CreateTableOperation) in that it will create the target database schema if it does not already exist. Generated SQL should be added using the Statement method.

Generate(DateTime) Generate(DateTime) Generate(DateTime)

Generates SQL to specify a constant DateTime default value being set on a column. This method just generates the actual value, not the SQL to set the default value.

Generate(DateTimeOffset) Generate(DateTimeOffset) Generate(DateTimeOffset)

Generates SQL to specify a constant DateTimeOffset default value being set on a column. This method just generates the actual value, not the SQL to set the default value.

Generate(DbGeography) Generate(DbGeography) Generate(DbGeography)

Generates SQL to specify a constant geogrpahy default value being set on a column. This method just generates the actual value, not the SQL to set the default value.

Generate(DbGeometry) Generate(DbGeometry) Generate(DbGeometry)

Generates SQL to specify a constant geometry default value being set on a column. This method just generates the actual value, not the SQL to set the default value.

Generate(DropColumnOperation) Generate(DropColumnOperation) Generate(DropColumnOperation)

Generates SQL for a DropColumnOperation. Generated SQL should be added using the Statement method.

Generate(DropForeignKeyOperation) Generate(DropForeignKeyOperation) Generate(DropForeignKeyOperation)

Generates SQL for a DropForeignKeyOperation. Generated SQL should be added using the Statement method.

Generate(DropIndexOperation) Generate(DropIndexOperation) Generate(DropIndexOperation)

Generates SQL for a DropIndexOperation. Generated SQL should be added using the Statement method.

Generate(DropPrimaryKeyOperation) Generate(DropPrimaryKeyOperation) Generate(DropPrimaryKeyOperation)

Generates SQL for a DropPrimaryKeyOperation. Generated SQL should be added using the Statement method.

Generate(DropProcedureOperation) Generate(DropProcedureOperation) Generate(DropProcedureOperation)

Generates the specified drop procedure operation.

Generate(DropTableOperation) Generate(DropTableOperation) Generate(DropTableOperation)

Generates SQL for a DropTableOperation. Generated SQL should be added using the Statement method.

Generate(Guid) Generate(Guid) Generate(Guid)

Generates SQL to specify a constant Guid default value being set on a column. This method just generates the actual value, not the SQL to set the default value.

Generate(HistoryOperation) Generate(HistoryOperation) Generate(HistoryOperation)

Generates SQL for a HistoryOperation. Generated SQL should be added using the Statement method.

Generate(IEnumerable<MigrationOperation>, String) Generate(IEnumerable<MigrationOperation>, String) Generate(IEnumerable<MigrationOperation>, String)

Converts a set of migration operations into Microsoft SQL Server specific SQL.

Generate(MigrationOperation) Generate(MigrationOperation) Generate(MigrationOperation)

Generates SQL for a MigrationOperation. Allows derived providers to handle additional operation types. Generated SQL should be added using the Statement method.

Generate(MoveProcedureOperation) Generate(MoveProcedureOperation) Generate(MoveProcedureOperation)

Generates the specified move procedure operation.

Generate(MoveTableOperation) Generate(MoveTableOperation) Generate(MoveTableOperation)

Generates SQL for a MoveTableOperation. Generated SQL should be added using the Statement method.

Generate(Object) Generate(Object) Generate(Object)

Generates SQL to specify a constant default value being set on a column. This method just generates the actual value, not the SQL to set the default value.

Generate(RenameColumnOperation) Generate(RenameColumnOperation) Generate(RenameColumnOperation)

Generates SQL for a RenameColumnOperation. Generated SQL should be added using the Statement method.

Generate(RenameIndexOperation) Generate(RenameIndexOperation) Generate(RenameIndexOperation)

Generates SQL for a RenameIndexOperation. Generated SQL should be added using the Statement method.

Generate(RenameProcedureOperation) Generate(RenameProcedureOperation) Generate(RenameProcedureOperation)

Generates the specified rename procedure operation.

Generate(RenameTableOperation) Generate(RenameTableOperation) Generate(RenameTableOperation)

Generates SQL for a RenameTableOperation. Generated SQL should be added using the Statement method.

Generate(SqlOperation) Generate(SqlOperation) Generate(SqlOperation)

Generates SQL for a SqlOperation. Generated SQL should be added using the Statement or StatementBatch methods.

Generate(String) Generate(String) Generate(String)

Generates SQL to specify a constant string default value being set on a column. This method just generates the actual value, not the SQL to set the default value.

Generate(TimeSpan) Generate(TimeSpan) Generate(TimeSpan)

Generates SQL to specify a constant TimeSpan default value being set on a column. This method just generates the actual value, not the SQL to set the default value.

Generate(UpdateDatabaseOperation) Generate(UpdateDatabaseOperation) Generate(UpdateDatabaseOperation)

Generates the specified update database operation which represents applying a series of migrations. The generated script is idempotent, meaning it contains conditional logic to check if individual migrations have already been applied and only apply the pending ones.

GenerateCreateSchema(String) GenerateCreateSchema(String) GenerateCreateSchema(String)

Generates SQL to create a database schema. Generated SQL should be added using the Statement method.

GenerateMakeSystemTable(CreateTableOperation, IndentedTextWriter) GenerateMakeSystemTable(CreateTableOperation, IndentedTextWriter) GenerateMakeSystemTable(CreateTableOperation, IndentedTextWriter)

Generates SQL to mark a table as a system table. Generated SQL should be added using the Statement method.

GenerateProcedureBody(ICollection<DbModificationCommandTree>, String, String) GenerateProcedureBody(ICollection<DbModificationCommandTree>, String, String) GenerateProcedureBody(ICollection<DbModificationCommandTree>, String, String)

Generates the SQL body for a stored procedure.

IsPermissionDeniedError(Exception) IsPermissionDeniedError(Exception) IsPermissionDeniedError(Exception)

Determines if a provider specific exception corresponds to a database-level permission denied error.

Name(String) Name(String) Name(String)

Generates a quoted name. The supplied name may or may not contain the schema.

Quote(String) Quote(String) Quote(String)

Quotes an identifier for SQL Server.

Statement(IndentedTextWriter, String) Statement(IndentedTextWriter, String) Statement(IndentedTextWriter, String)

Adds a new Statement to be executed against the database.

Statement(String, Boolean, String) Statement(String, Boolean, String) Statement(String, Boolean, String)

Adds a new Statement to be executed against the database.

StatementBatch(String, Boolean) StatementBatch(String, Boolean) StatementBatch(String, Boolean)

Breaks sql string into one or more statements, handling T-SQL utility statements as necessary.

WriteCreateTable(CreateTableOperation) WriteCreateTable(CreateTableOperation) WriteCreateTable(CreateTableOperation)

Generates SQL for a CreateTableOperation. Generated SQL should be added using the Statement method.

WriteCreateTable(CreateTableOperation, IndentedTextWriter) WriteCreateTable(CreateTableOperation, IndentedTextWriter) WriteCreateTable(CreateTableOperation, IndentedTextWriter)

Writes CREATE TABLE SQL to the target writer.

Writer() Writer() Writer()

Gets a new IndentedTextWriter that can be used to build SQL. This is just a helper method to create a writer. Writing to the writer will not cause SQL to be registered for execution. You must pass the generated SQL to the Statement method.

Applies to