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)
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(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(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(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(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
文字編輯器,用來加入產生的程式碼。