語言

CSharpMigrationsGenerator 類別

定義

用來產生 C# 遷移程式碼。

public class CSharpMigrationsGenerator : Microsoft.EntityFrameworkCore.Migrations.Design.MigrationsCodeGenerator
[System.Runtime.CompilerServices.Nullable(0)]
public class CSharpMigrationsGenerator : Microsoft.EntityFrameworkCore.Migrations.Design.MigrationsCodeGenerator
type CSharpMigrationsGenerator = class
    inherit MigrationsCodeGenerator
[<System.Runtime.CompilerServices.Nullable(0)>]
type CSharpMigrationsGenerator = class
    inherit MigrationsCodeGenerator
Public Class CSharpMigrationsGenerator
Inherits MigrationsCodeGenerator
繼承
CSharpMigrationsGenerator
屬性

備註

更多資訊與範例請參閱 資料庫遷移及 EF Core 設計時服務 。

建構函式

名稱 Description
CSharpMigrationsGenerator(CSharpHelper, CSharpMigrationOperationGenerator, CSharpSnapshotGenerator)

用來產生 C# 遷移程式碼。

CSharpMigrationsGenerator(MigrationsCodeGeneratorDependencies, CSharpMigrationsGeneratorDependencies)

初始化 CSharpMigrationsGenerator 類別的新執行個體。

屬性

名稱 Description
CSharpDependencies

此服務的依賴關係。

Dependencies

此服務的依賴關係。

(繼承來源 MigrationsCodeGenerator)
FileExtension

取得檔案應該使用的副檔名代碼。

Language

取得此服務支援的程式語言。

方法

名稱 Description
GenerateMetadata(String, Type, String, String, IModel)

產生遷移的元資料程式碼。

GenerateMigration(String, String, IReadOnlyList<MigrationOperation>, IReadOnlyList<MigrationOperation>)

產生遷移程式碼。

GenerateSnapshot(String, Type, String, IModel, String)

產生模型快照程式碼。

GenerateSnapshot(String, Type, String, IModel)

產生模型快照程式碼。

GetNamespaces(IEnumerable<MigrationOperation>)

取得物件清單 MigrationOperation 所需的命名空間。

(繼承來源 MigrationsCodeGenerator)
GetNamespaces(IModel)

取得所需的命名空間。IModel

(繼承來源 MigrationsCodeGenerator)

適用於