CSharpMigrationCodeGenerator.Generate 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
Generate(CreateProcedureOperation, IndentedTextWriter)
生成代码以执行 CreateProcedureOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.CreateProcedureOperation createProcedureOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.CreateProcedureOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- createProcedureOperation
- CreateProcedureOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(CreateTableOperation, IndentedTextWriter)
生成代码以执行 CreateTableOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.CreateTableOperation createTableOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.CreateTableOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- createTableOperation
- CreateTableOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(DropColumnOperation, IndentedTextWriter)
生成代码以执行 DropColumnOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.DropColumnOperation dropColumnOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.DropColumnOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- dropColumnOperation
- DropColumnOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(DropForeignKeyOperation, IndentedTextWriter)
生成代码以执行 DropForeignKeyOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.DropForeignKeyOperation dropForeignKeyOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.DropForeignKeyOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- dropForeignKeyOperation
- DropForeignKeyOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(DropIndexOperation, IndentedTextWriter)
生成代码以执行 DropIndexOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.DropIndexOperation dropIndexOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.DropIndexOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- dropIndexOperation
- DropIndexOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(DropProcedureOperation, IndentedTextWriter)
生成代码以执行 DropProcedureOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.DropProcedureOperation dropProcedureOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.DropProcedureOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- dropProcedureOperation
- DropProcedureOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(DropTableOperation, IndentedTextWriter)
生成代码以执行 DropTableOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.DropTableOperation dropTableOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.DropTableOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- dropTableOperation
- DropTableOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(MoveProcedureOperation, IndentedTextWriter)
生成代码以执行 MoveProcedureOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.MoveProcedureOperation moveProcedureOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.MoveProcedureOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- moveProcedureOperation
- MoveProcedureOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(MoveTableOperation, IndentedTextWriter)
生成代码以执行 MoveTableOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.MoveTableOperation moveTableOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.MoveTableOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- moveTableOperation
- MoveTableOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(RenameColumnOperation, IndentedTextWriter)
生成代码以执行 RenameColumnOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.RenameColumnOperation renameColumnOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.RenameColumnOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- renameColumnOperation
- RenameColumnOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(RenameIndexOperation, IndentedTextWriter)
生成代码以执行 RenameIndexOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.RenameIndexOperation renameIndexOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.RenameIndexOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- renameIndexOperation
- RenameIndexOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(RenameProcedureOperation, IndentedTextWriter)
生成代码以执行 RenameProcedureOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.RenameProcedureOperation renameProcedureOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.RenameProcedureOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- renameProcedureOperation
- RenameProcedureOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(RenameTableOperation, IndentedTextWriter)
生成代码以执行 RenameTableOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.RenameTableOperation renameTableOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.RenameTableOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- renameTableOperation
- RenameTableOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(SqlOperation, IndentedTextWriter)
生成代码以执行 SqlOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.SqlOperation sqlOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.SqlOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- sqlOperation
- SqlOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(IEnumerable<MigrationOperation>, String, String)
生成用户可以查看和编辑的主代码文件。
[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.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId="namespace")]
[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);
override this.Generate : seq<System.Data.Entity.Migrations.Model.MigrationOperation> * string * string -> string
Protected Overridable Function Generate (operations As IEnumerable(Of MigrationOperation), namespace As String, className As String) As String
参数
- operations
- IEnumerable<MigrationOperation>
迁移要执行的操作。
- namespace
- String
应在中生成代码的命名空间。
- className
- String
应生成的类的名称。
返回
生成的代码。
- 属性
适用于
Generate(ColumnModel, IndentedTextWriter, Boolean)
生成代码以指定 的定义 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.Globalization", "CA1308:NormalizeStringsToUppercase")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected virtual void Generate (System.Data.Entity.Migrations.Model.ColumnModel column, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer, bool emitName = false);
override this.Generate : System.Data.Entity.Migrations.Model.ColumnModel * System.Data.Entity.Migrations.Utilities.IndentedTextWriter * bool -> unit
Protected Overridable Sub Generate (column As ColumnModel, writer As IndentedTextWriter, Optional emitName As Boolean = false)
参数
- column
- ColumnModel
要为其生成代码的列定义。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
- emitName
- Boolean
一个值,该值指示是否在定义中包含列名。
- 属性
适用于
Generate(ParameterModel, IndentedTextWriter, Boolean)
生成代码以指定 的定义 ParameterModel。
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
protected virtual void Generate (System.Data.Entity.Migrations.Model.ParameterModel parameterModel, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer, bool emitName = false);
override this.Generate : System.Data.Entity.Migrations.Model.ParameterModel * System.Data.Entity.Migrations.Utilities.IndentedTextWriter * bool -> unit
参数
- parameterModel
- ParameterModel
要为其生成代码的参数定义。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
- emitName
- Boolean
一个值,该值指示是否在定义中包含列名。
- 属性
适用于
Generate(String, String, String, String, String)
使用迁移元数据生成代码隐藏文件。
[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);
override this.Generate : string * string * string * string * string -> string
Protected Overridable Function Generate (migrationId As String, sourceModel As String, targetModel As String, namespace As String, className As String) As String
参数
- migrationId
- String
迁移的唯一标识符。
- sourceModel
- String
要存储在迁移元数据中的源模型。
- targetModel
- String
要存储在迁移元数据中的目标模型。
- namespace
- String
应在中生成代码的命名空间。
- className
- String
应生成的类的名称。
返回
生成的代码。
- 属性
适用于
Generate(String, IEnumerable<MigrationOperation>, String, String, String, String)
生成应添加到用户项目的代码。
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);
override this.Generate : string * seq<System.Data.Entity.Migrations.Model.MigrationOperation> * string * string * string * string -> System.Data.Entity.Migrations.Design.ScaffoldedMigration
Public Overrides Function Generate (migrationId As String, operations As IEnumerable(Of MigrationOperation), sourceModel As String, targetModel As String, namespace As String, className As String) As ScaffoldedMigration
参数
- migrationId
- String
迁移的唯一标识符。
- operations
- IEnumerable<MigrationOperation>
迁移要执行的操作。
- sourceModel
- String
要存储在迁移元数据中的源模型。
- targetModel
- String
要存储在迁移元数据中的目标模型。
- namespace
- String
应在中生成代码的命名空间。
- className
- String
应生成的类的名称。
返回
生成的代码。
适用于
Generate(CreateIndexOperation, IndentedTextWriter)
生成代码以执行 CreateIndexOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.CreateIndexOperation createIndexOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.CreateIndexOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- createIndexOperation
- CreateIndexOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(AlterTableOperation, IndentedTextWriter)
为 AlterTableOperation生成代码。
protected internal virtual void Generate (System.Data.Entity.Migrations.Model.AlterTableOperation alterTableOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.AlterTableOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- alterTableOperation
- AlterTableOperation
应为其生成代码的操作。
- writer
- IndentedTextWriter
应向其写入生成的代码的编写器。
适用于
Generate(DropPrimaryKeyOperation, IndentedTextWriter)
生成代码以执行 DropPrimaryKeyOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.DropPrimaryKeyOperation dropPrimaryKeyOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.DropPrimaryKeyOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- dropPrimaryKeyOperation
- DropPrimaryKeyOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(AlterColumnOperation, IndentedTextWriter)
生成代码以执行 AlterColumnOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.AlterColumnOperation alterColumnOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.AlterColumnOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- alterColumnOperation
- AlterColumnOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(Byte)
Generate(Byte[])
Generate(DbGeography)
生成代码以指定列的 DbGeography 默认值。
protected virtual string Generate (System.Data.Entity.Spatial.DbGeography defaultValue);
override this.Generate : System.Data.Entity.Spatial.DbGeography -> string
Protected Overridable Function Generate (defaultValue As DbGeography) As String
参数
- defaultValue
- DbGeography
要用作默认值的值。
返回
表示默认值的代码。
适用于
Generate(AlterProcedureOperation, IndentedTextWriter)
生成代码以执行 AlterProcedureOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.AlterProcedureOperation alterProcedureOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.AlterProcedureOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- alterProcedureOperation
- AlterProcedureOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(DbGeography)
生成代码以指定列的 DbGeography 默认值。
protected virtual string Generate (System.Data.Spatial.DbGeography defaultValue);
override this.Generate : System.Data.Spatial.DbGeography -> string
Protected Overridable Function Generate (defaultValue As DbGeography) As String
参数
- defaultValue
- DbGeography
要用作默认值的值。
返回
表示默认值的代码。
适用于
Generate(DbGeometry)
生成代码以指定列的 DbGeometry 默认值。
protected virtual string Generate (System.Data.Spatial.DbGeometry defaultValue);
override this.Generate : System.Data.Spatial.DbGeometry -> string
Protected Overridable Function Generate (defaultValue As DbGeometry) As String
参数
- defaultValue
- DbGeometry
要用作默认值的值。
返回
表示默认值的代码。
适用于
Generate(DateTime)
Generate(DateTimeOffset)
生成代码以指定列的 DateTimeOffset 默认值。
protected virtual string Generate (DateTimeOffset defaultValue);
override this.Generate : DateTimeOffset -> string
Protected Overridable Function Generate (defaultValue As DateTimeOffset) As String
参数
- defaultValue
- DateTimeOffset
要用作默认值的值。
返回
表示默认值的代码。
适用于
Generate(Decimal)
Generate(Guid)
Generate(DbGeometry)
生成代码以指定列的 DbGeometry 默认值。
protected virtual string Generate (System.Data.Entity.Spatial.DbGeometry defaultValue);
override this.Generate : System.Data.Entity.Spatial.DbGeometry -> string
Protected Overridable Function Generate (defaultValue As DbGeometry) As String
参数
- defaultValue
- DbGeometry
要用作默认值的值。
返回
表示默认值的代码。
适用于
Generate(Object)
生成代码以指定未知数据类型列的默认值。
protected virtual string Generate (object defaultValue);
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")]
protected virtual string Generate (object defaultValue);
override this.Generate : obj -> string
Protected Overridable Function Generate (defaultValue As Object) As String
参数
- defaultValue
- Object
要用作默认值的值。
返回
表示默认值的代码。
- 属性
适用于
Generate(Single)
Generate(String)
Generate(Int64)
Generate(TimeSpan)
Generate(IEnumerable<String>, IndentedTextWriter)
生成代码以使用 lambda 表达式指定一组列名。
protected virtual void Generate (System.Collections.Generic.IEnumerable<string> columns, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : seq<string> * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
Protected Overridable Sub Generate (columns As IEnumerable(Of String), writer As IndentedTextWriter)
参数
- columns
- IEnumerable<String>
要为其生成代码的列。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(AddColumnOperation, IndentedTextWriter)
生成代码以执行 AddColumnOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.AddColumnOperation addColumnOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.AddColumnOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- addColumnOperation
- AddColumnOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(AddForeignKeyOperation, IndentedTextWriter)
生成代码以执行 AddForeignKeyOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.AddForeignKeyOperation addForeignKeyOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.AddForeignKeyOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- addForeignKeyOperation
- AddForeignKeyOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。
适用于
Generate(AddPrimaryKeyOperation, IndentedTextWriter)
生成代码以执行 AddPrimaryKeyOperation。
protected virtual void Generate (System.Data.Entity.Migrations.Model.AddPrimaryKeyOperation addPrimaryKeyOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter writer);
override this.Generate : System.Data.Entity.Migrations.Model.AddPrimaryKeyOperation * System.Data.Entity.Migrations.Utilities.IndentedTextWriter -> unit
参数
- addPrimaryKeyOperation
- AddPrimaryKeyOperation
要为其生成代码的操作。
- writer
- IndentedTextWriter
要向其添加生成的代码的文本编写器。