Sprache

DbContextAttribute Klasse

Definition

Gibt die Klasse an, zu der DbContext eine Klasse gehört. Dieses Attribut wird beispielsweise verwendet, um zu identifizieren, für welchen Kontext eine Migration gilt. Es wird auch verwendet, um die Kontexte anzugeben, die in einer Assembly für Entwurfszeittools verwendet werden.

[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
Vererbung
DbContextAttribute
Attribute

Hinweise

Weitere Informationen und Beispiele finden Sie unter Verwalten von Datenbankschemas mit EF Core .

Konstruktoren

Name Beschreibung
DbContextAttribute(Type)

Initialisiert eine neue Instanz der DbContextAttribute-Klasse.

Eigenschaften

Name Beschreibung
ContextType

Ruft den zugeordneten Kontext ab.

Gilt für: