共用方式為


IMigrator.GenerateScript 方法

定義

多載

GenerateScript(String, String, MigrationsSqlGenerationOptions)

產生 SQL 腳本,以完整移轉資料庫,或從指定的移轉開始和結束。

GenerateScript(String, String, Boolean)

產生 SQL 腳本,以完整移轉資料庫,或從指定的移轉開始和結束。

GenerateScript(String, String, MigrationsSqlGenerationOptions)

來源:
IMigrator.cs
來源:
IMigrator.cs
來源:
IMigrator.cs

產生 SQL 腳本,以完整移轉資料庫,或從指定的移轉開始和結束。

public string GenerateScript (string fromMigration = default, string toMigration = default, Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions options = Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions.Default);
public string GenerateScript (string? fromMigration = default, string? toMigration = default, Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions options = Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions.Default);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Migration generation currently isn't compatible with trimming")]
public string GenerateScript (string? fromMigration = default, string? toMigration = default, Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions options = Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions.Default);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Migration generation currently isn't compatible with trimming")]
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Migrations operations are not supported with NativeAOT")]
public string GenerateScript (string? fromMigration = default, string? toMigration = default, Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions options = Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions.Default);
abstract member GenerateScript : string * string * Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions -> string
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Migration generation currently isn't compatible with trimming")>]
abstract member GenerateScript : string * string * Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions -> string
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Migration generation currently isn't compatible with trimming")>]
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Migrations operations are not supported with NativeAOT")>]
abstract member GenerateScript : string * string * Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions -> string
Public Function GenerateScript (Optional fromMigration As String = Nothing, Optional toMigration As String = Nothing, Optional options As MigrationsSqlGenerationOptions = Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions.Default) As String

參數

fromMigration
String

要從中啟動的移轉,或 null 從空白資料庫啟動。

toMigration
String

要移轉資料庫的目標移轉,或 null 移轉至最新版本。

options
MigrationsSqlGenerationOptions

產生 SQL 以進行移轉時要使用的選項。

傳回

產生的指令碼。

屬性

備註

如需詳細資訊和範例 ,請參閱資料庫移 轉。

適用於

GenerateScript(String, String, Boolean)

產生 SQL 腳本,以完整移轉資料庫,或從指定的移轉開始和結束。

public string GenerateScript (string fromMigration = default, string toMigration = default, bool idempotent = false);
abstract member GenerateScript : string * string * bool -> string
Public Function GenerateScript (Optional fromMigration As String = Nothing, Optional toMigration As String = Nothing, Optional idempotent As Boolean = false) As String

參數

fromMigration
String

要從中啟動的移轉,或 null 從空白資料庫啟動。

toMigration
String

要移轉資料庫的目標移轉,或 null 移轉至最新版本。

idempotent
Boolean

如果 true 為 ,則會產生等冪腳本,否則會產生腳本,假設指定的範圍中沒有任何移轉已套用至資料庫。

傳回

產生的指令碼。

適用於