IMigrator.GenerateScript 方法

定义

重载

GenerateScript(String, String, MigrationsSqlGenerationOptions)

生成一个 SQL 脚本,用于迁移整个数据库,或者在指定迁移时开始和结束。

GenerateScript(String, String, Boolean)

生成一个 SQL 脚本,用于迁移整个数据库,或者在指定迁移时开始和结束。

GenerateScript(String, String, MigrationsSqlGenerationOptions)

Source:
IMigrator.cs
Source:
IMigrator.cs
Source:
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为 ,则将生成幂等脚本,否则将生成脚本,假定指定范围内没有任何迁移已应用于数据库。

返回

生成的脚本。

适用于