VisualBasicMigrationCodeGenerator.Generate Method

Definition

Overloads

Generate(CreateProcedureOperation, IndentedTextWriter)

Generates code to perform a CreateProcedureOperation.

Generate(CreateTableOperation, IndentedTextWriter)

Generates code to perform a CreateTableOperation.

Generate(DropColumnOperation, IndentedTextWriter)

Generates code to perform a DropColumnOperation.

Generate(DropForeignKeyOperation, IndentedTextWriter)

Generates code to perform a DropForeignKeyOperation.

Generate(DropIndexOperation, IndentedTextWriter)

Generates code to perform a DropIndexOperation.

Generate(DropProcedureOperation, IndentedTextWriter)

Generates code to perform a DropProcedureOperation.

Generate(DropTableOperation, IndentedTextWriter)

Generates code to perform a DropTableOperation.

Generate(MoveProcedureOperation, IndentedTextWriter)

Generates code to perform a MoveProcedureOperation.

Generate(MoveTableOperation, IndentedTextWriter)

Generates code to perform a MoveTableOperation.

Generate(RenameColumnOperation, IndentedTextWriter)

Generates code to perform a RenameColumnOperation.

Generate(RenameIndexOperation, IndentedTextWriter)

Generates code to perform a RenameIndexOperation.

Generate(RenameProcedureOperation, IndentedTextWriter)

Generates code to perform a RenameProcedureOperation.

Generate(RenameTableOperation, IndentedTextWriter)

Generates code to perform a RenameTableOperation.

Generate(SqlOperation, IndentedTextWriter)

Generates code to perform a SqlOperation.

Generate(IEnumerable<MigrationOperation>, String, String)

Generates the primary code file that the user can view and edit.

Generate(ColumnModel, IndentedTextWriter, Boolean)

Generates code to specify the definition for a ColumnModel.

Generate(ParameterModel, IndentedTextWriter, Boolean)

Generates code to perform a ParameterModel.

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

Generates the code behind file with migration metadata.

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

Generates the code that should be added to the users project.

Generate(CreateIndexOperation, IndentedTextWriter)

Generates code to perform a CreateIndexOperation.

Generate(AlterTableOperation, IndentedTextWriter)

Generates code for an AlterTableOperation.

Generate(DropPrimaryKeyOperation, IndentedTextWriter)

Generates code to perform a DropPrimaryKeyOperation.

Generate(AlterColumnOperation, IndentedTextWriter)

Generates code to perform an AlterColumnOperation.

Generate(Byte)

Generates code to specify the default value for a Byte column.

Generate(Byte[])

Generates code to specify the default value for a byte[] column.

Generate(DbGeography)

Generates code to specify the default value for a DbGeography column.

Generate(AlterProcedureOperation, IndentedTextWriter)

Generates code to perform a AlterProcedureOperation.

Generate(DbGeography)

Generates code to specify the default value for a DbGeography column.

Generate(DbGeometry)

Generates code to specify the default value for a DbGeometry column.

Generate(DateTime)

Generates code to specify the default value for a DateTime column.

Generate(DateTimeOffset)

Generates code to specify the default value for a DateTimeOffset column.

Generate(Decimal)

Generates code to specify the default value for a Decimal column.

Generate(Guid)

Generates code to specify the default value for a Guid column.

Generate(DbGeometry)

Generates code to specify the default value for a DbGeometry column.

Generate(Object)

Generates code to specify the default value for a column of unknown data type.

Generate(Single)

Generates code to specify the default value for a Single column.

Generate(String)

Generates code to specify the default value for a String column.

Generate(Int64)

Generates code to specify the default value for a Int64 column.

Generate(TimeSpan)

Generates code to specify the default value for a TimeSpan column.

Generate(IEnumerable<String>, IndentedTextWriter)

Generates code to specify a set of column names using a lambda expression.

Generate(AddColumnOperation, IndentedTextWriter)

Generates code to perform an AddColumnOperation.

Generate(AddForeignKeyOperation, IndentedTextWriter)

Generates code to perform an AddForeignKeyOperation.

Generate(AddPrimaryKeyOperation, IndentedTextWriter)

Generates code to perform an AddPrimaryKeyOperation.

Generate(CreateProcedureOperation, IndentedTextWriter)

Generates code to perform a CreateProcedureOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.CreateProcedureOperation createProcedureOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

createProcedureOperation
CreateProcedureOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(CreateTableOperation, IndentedTextWriter)

Generates code to perform a CreateTableOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.CreateTableOperation createTableOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

createTableOperation
CreateTableOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(DropColumnOperation, IndentedTextWriter)

Generates code to perform a DropColumnOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.DropColumnOperation dropColumnOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

dropColumnOperation
DropColumnOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(DropForeignKeyOperation, IndentedTextWriter)

Generates code to perform a DropForeignKeyOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.DropForeignKeyOperation dropForeignKeyOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

dropForeignKeyOperation
DropForeignKeyOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(DropIndexOperation, IndentedTextWriter)

Generates code to perform a DropIndexOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.DropIndexOperation dropIndexOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

dropIndexOperation
DropIndexOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(DropProcedureOperation, IndentedTextWriter)

Generates code to perform a DropProcedureOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.DropProcedureOperation dropProcedureOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

dropProcedureOperation
DropProcedureOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(DropTableOperation, IndentedTextWriter)

Generates code to perform a DropTableOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.DropTableOperation dropTableOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

dropTableOperation
DropTableOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(MoveProcedureOperation, IndentedTextWriter)

Generates code to perform a MoveProcedureOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.MoveProcedureOperation moveProcedureOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

moveProcedureOperation
MoveProcedureOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(MoveTableOperation, IndentedTextWriter)

Generates code to perform a MoveTableOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.MoveTableOperation moveTableOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

moveTableOperation
MoveTableOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(RenameColumnOperation, IndentedTextWriter)

Generates code to perform a RenameColumnOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.RenameColumnOperation renameColumnOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

renameColumnOperation
RenameColumnOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(RenameIndexOperation, IndentedTextWriter)

Generates code to perform a RenameIndexOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.RenameIndexOperation renameIndexOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

renameIndexOperation
RenameIndexOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(RenameProcedureOperation, IndentedTextWriter)

Generates code to perform a RenameProcedureOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.RenameProcedureOperation renameProcedureOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

renameProcedureOperation
RenameProcedureOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(RenameTableOperation, IndentedTextWriter)

Generates code to perform a RenameTableOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.RenameTableOperation renameTableOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

renameTableOperation
RenameTableOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(SqlOperation, IndentedTextWriter)

Generates code to perform a SqlOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.SqlOperation sqlOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

sqlOperation
SqlOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(IEnumerable<MigrationOperation>, String, String)

Generates the primary code file that the user can view and edit.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times")]
protected virtual string Generate(System.Collections.Generic.IEnumerable<System.Data.Entity.Migrations.Model.MigrationOperation> operations, string namespace, string className);
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId="namespace")]
protected virtual string Generate(System.Collections.Generic.IEnumerable<System.Data.Entity.Migrations.Model.MigrationOperation> operations, string namespace, string className);

Parameters

operations
IEnumerable<MigrationOperation>

Operations to be performed by the migration.

namespace
String

Namespace that code should be generated in.

className
String

Name of the class that should be generated.

Returns

The generated code.

Attributes

Applies to

Generate(ColumnModel, IndentedTextWriter, Boolean)

Generates code to specify the definition for a ColumnModel.

protected virtual void Generate(System.Data.Entity.Migrations.Model.ColumnModel column, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer, bool emitName = false);
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")]
protected virtual void Generate(System.Data.Entity.Migrations.Model.ColumnModel column, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer, bool emitName = false);

Parameters

column
ColumnModel

The column definition to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

emitName
Boolean

A value indicating whether to include the column name in the definition.

Attributes

Applies to

Generate(ParameterModel, IndentedTextWriter, Boolean)

Generates code to perform a ParameterModel.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")]
protected virtual void Generate(System.Data.Entity.Migrations.Model.ParameterModel parameterModel, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer, bool emitName = false);

Parameters

parameterModel
ParameterModel

The parameter model definition to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

emitName
Boolean

true to include the column name in the definition; otherwise, false.

Attributes

Applies to

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

Generates the code behind file with migration metadata.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times")]
protected virtual string Generate(string migrationId, string sourceModel, string targetModel, string namespace, string className);
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId="namespace")]
protected virtual string Generate(string migrationId, string sourceModel, string targetModel, string namespace, string className);

Parameters

migrationId
String

Unique identifier of the migration.

sourceModel
String

Source model to be stored in the migration metadata.

targetModel
String

Target model to be stored in the migration metadata.

namespace
String

Namespace that code should be generated in.

className
String

Name of the class that should be generated.

Returns

The generated code.

Attributes

Applies to

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

Generates the code that should be added to the users project.

public override System.Data.Entity.Migrations.Design.ScaffoldedMigration Generate(string migrationId, System.Collections.Generic.IEnumerable<System.Data.Entity.Migrations.Model.MigrationOperation> operations, string sourceModel, string targetModel, string namespace, string className);

Parameters

migrationId
String

Unique identifier of the migration.

operations
IEnumerable<MigrationOperation>

Operations to be performed by the migration.

sourceModel
String

Source model to be stored in the migration metadata.

targetModel
String

Target model to be stored in the migration metadata.

namespace
String

Namespace that code should be generated in.

className
String

Name of the class that should be generated.

Returns

The generated code.

Applies to

Generate(CreateIndexOperation, IndentedTextWriter)

Generates code to perform a CreateIndexOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.CreateIndexOperation createIndexOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

createIndexOperation
CreateIndexOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(AlterTableOperation, IndentedTextWriter)

Generates code for an AlterTableOperation.

protected internal virtual void Generate(System.Data.Entity.Migrations.Model.AlterTableOperation alterTableOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

alterTableOperation
AlterTableOperation

The operation for which code should be generated.

writer
IndentedTextWriter

The writer to which generated code should be written.

Applies to

Generate(DropPrimaryKeyOperation, IndentedTextWriter)

Generates code to perform a DropPrimaryKeyOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.DropPrimaryKeyOperation dropPrimaryKeyOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

dropPrimaryKeyOperation
DropPrimaryKeyOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(AlterColumnOperation, IndentedTextWriter)

Generates code to perform an AlterColumnOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.AlterColumnOperation alterColumnOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

alterColumnOperation
AlterColumnOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(Byte)

Generates code to specify the default value for a Byte column.

protected virtual string Generate(byte defaultValue);

Parameters

defaultValue
Byte

The value to be used as the default.

Returns

Code representing the default value.

Applies to

Generate(Byte[])

Generates code to specify the default value for a byte[] column.

protected virtual string Generate(byte[] defaultValue);

Parameters

defaultValue
Byte[]

The value to be used as the default.

Returns

Code representing the default value.

Applies to

Generate(DbGeography)

Generates code to specify the default value for a DbGeography column.

protected virtual string Generate(System.Data.Entity.Spatial.DbGeography defaultValue);

Parameters

defaultValue
DbGeography

The value to be used as the default.

Returns

Code representing the default value.

Applies to

Generate(AlterProcedureOperation, IndentedTextWriter)

Generates code to perform a AlterProcedureOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.AlterProcedureOperation alterProcedureOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

alterProcedureOperation
AlterProcedureOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(DbGeography)

Generates code to specify the default value for a DbGeography column.

protected virtual string Generate(System.Data.Spatial.DbGeography defaultValue);

Parameters

defaultValue
DbGeography

The value to be used as the default.

Returns

Code representing the default value.

Applies to

Generate(DbGeometry)

Generates code to specify the default value for a DbGeometry column.

protected virtual string Generate(System.Data.Spatial.DbGeometry defaultValue);

Parameters

defaultValue
DbGeometry

The value to be used as the default.

Returns

Code representing the default value.

Applies to

Generate(DateTime)

Generates code to specify the default value for a DateTime column.

protected virtual string Generate(DateTime defaultValue);

Parameters

defaultValue
DateTime

The value to be used as the default.

Returns

Code representing the default value.

Applies to

Generate(DateTimeOffset)

Generates code to specify the default value for a DateTimeOffset column.

protected virtual string Generate(DateTimeOffset defaultValue);

Parameters

defaultValue
DateTimeOffset

The value to be used as the default.

Returns

Code representing the default value.

Applies to

Generate(Decimal)

Generates code to specify the default value for a Decimal column.

protected virtual string Generate(decimal defaultValue);

Parameters

defaultValue
Decimal

The value to be used as the default.

Returns

Code representing the default value.

Applies to

Generate(Guid)

Generates code to specify the default value for a Guid column.

protected virtual string Generate(Guid defaultValue);

Parameters

defaultValue
Guid

The value to be used as the default.

Returns

Code representing the default value.

Applies to

Generate(DbGeometry)

Generates code to specify the default value for a DbGeometry column.

protected virtual string Generate(System.Data.Entity.Spatial.DbGeometry defaultValue);

Parameters

defaultValue
DbGeometry

The value to be used as the default.

Returns

Code representing the default value.

Applies to

Generate(Object)

Generates code to specify the default value for a column of unknown data type.

protected virtual string Generate(object defaultValue);
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")]
protected virtual string Generate(object defaultValue);

Parameters

defaultValue
Object

The value to be used as the default.

Returns

Code representing the default value.

Attributes

Applies to

Generate(Single)

Generates code to specify the default value for a Single column.

protected virtual string Generate(float defaultValue);

Parameters

defaultValue
Single

The value to be used as the default.

Returns

Code representing the default value.

Applies to

Generate(String)

Generates code to specify the default value for a String column.

protected virtual string Generate(string defaultValue);

Parameters

defaultValue
String

The value to be used as the default.

Returns

Code representing the default value.

Applies to

Generate(Int64)

Generates code to specify the default value for a Int64 column.

protected virtual string Generate(long defaultValue);

Parameters

defaultValue
Int64

The value to be used as the default.

Returns

Code representing the default value.

Applies to

Generate(TimeSpan)

Generates code to specify the default value for a TimeSpan column.

protected virtual string Generate(TimeSpan defaultValue);

Parameters

defaultValue
TimeSpan

The value to be used as the default.

Returns

Code representing the default value.

Applies to

Generate(IEnumerable<String>, IndentedTextWriter)

Generates code to specify a set of column names using a lambda expression.

protected virtual void Generate(System.Collections.Generic.IEnumerable<string> columns, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

columns
IEnumerable<String>

The columns to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(AddColumnOperation, IndentedTextWriter)

Generates code to perform an AddColumnOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.AddColumnOperation addColumnOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

addColumnOperation
AddColumnOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(AddForeignKeyOperation, IndentedTextWriter)

Generates code to perform an AddForeignKeyOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.AddForeignKeyOperation addForeignKeyOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

addForeignKeyOperation
AddForeignKeyOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to

Generate(AddPrimaryKeyOperation, IndentedTextWriter)

Generates code to perform an AddPrimaryKeyOperation.

protected virtual void Generate(System.Data.Entity.Migrations.Model.AddPrimaryKeyOperation addPrimaryKeyOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);

Parameters

addPrimaryKeyOperation
AddPrimaryKeyOperation

The operation to generate code for.

writer
IndentedTextWriter

Text writer to add the generated code to.

Applies to