RelationalDatabaseFacadeExtensions.Migrate 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| Migrate(DatabaseFacade) |
將上下文中待處理的遷移資料套用到資料庫中。 如果資料庫還不存在,我會建立。 |
| Migrate(DatabaseFacade, String) |
將遷移應用於資料庫的上下文。 如果資料庫還不存在,我會建立。 |
Migrate(DatabaseFacade)
將上下文中待處理的遷移資料套用到資料庫中。 如果資料庫還不存在,我會建立。
public static void Migrate(this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Migrations operations are not supported with NativeAOT Use a migration bundle or an alternate way of executing migration operations.")]
public static void Migrate(this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade);
static member Migrate : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade -> unit
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Migrations operations are not supported with NativeAOT Use a migration bundle or an alternate way of executing migration operations.")>]
static member Migrate : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade -> unit
<Extension()>
Public Sub Migrate (databaseFacade As DatabaseFacade)
參數
- databaseFacade
- DatabaseFacade
這是 DatabaseFacade 給你背景的。
- 屬性
備註
請注意,此 API 與 EnsureCreated()是互斥的。 EnsureCreated 不使用遷移來建立資料庫,因此所建立的資料庫無法透過遷移進行後續更新。
更多資訊與範例請參見 資料庫遷移 。
適用於
Migrate(DatabaseFacade, String)
將遷移應用於資料庫的上下文。 如果資料庫還不存在,我會建立。
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Migrations operations are not supported with NativeAOT Use a migration bundle or an alternate way of executing migration operations.")]
public static void Migrate(this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, string? targetMigration);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Migrations operations are not supported with NativeAOT Use a migration bundle or an alternate way of executing migration operations.")>]
static member Migrate : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade * string -> unit
<Extension()>
Public Sub Migrate (databaseFacade As DatabaseFacade, targetMigration As String)
參數
- databaseFacade
- DatabaseFacade
這是 DatabaseFacade 給你背景的。
- targetMigration
- String
目標是遷移資料庫到 null 或遷移到最新版本。
- 屬性
備註
請注意,此 API 與 EnsureCreated()是互斥的。 EnsureCreated 不使用遷移來建立資料庫,因此所建立的資料庫無法透過遷移進行後續更新。
更多資訊與範例請參見 資料庫遷移 。