語言

DbContextAttribute 類別

定義

識別 DbContext 一個類別所屬的 。 例如,此屬性用來識別遷移所適用的上下文。 它也用來表示設計時工具在組件中所使用的上下文。

[System.AttributeUsage(System.AttributeTargets.Class)]
public sealed class DbContextAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class, AllowMultiple=true)]
[System.Runtime.CompilerServices.Nullable(0)]
public sealed class DbContextAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class)]
[System.Runtime.CompilerServices.Nullable(0)]
public sealed class DbContextAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class)>]
type DbContextAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class, AllowMultiple=true)>]
[<System.Runtime.CompilerServices.Nullable(0)>]
type DbContextAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class)>]
[<System.Runtime.CompilerServices.Nullable(0)>]
type DbContextAttribute = class
    inherit Attribute
Public NotInheritable Class DbContextAttribute
Inherits Attribute
繼承
DbContextAttribute
屬性

備註

更多資訊與範例請參閱「 使用 EF Core 管理資料庫結構 」。

建構函式

名稱 Description
DbContextAttribute(Type)

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

屬性

名稱 Description
ContextType

能理解相關的背景。

適用於