DbContext Konstruktoren

Definition

Überlädt

DbContext()

Initialisiert eine neue Instanz der DbContext-Klasse. Die OnConfiguring(DbContextOptionsBuilder) -Methode wird aufgerufen, um die Datenbank (und andere Optionen) zu konfigurieren, die für diesen Kontext verwendet werden sollen.

DbContext(DbContextOptions)

Initialisiert eine neue instance der DbContext -Klasse unter Verwendung der angegebenen Optionen. Die OnConfiguring(DbContextOptionsBuilder) -Methode wird weiterhin aufgerufen, um eine weitere Konfiguration der Optionen zu ermöglichen.

DbContext()

Initialisiert eine neue Instanz der DbContext-Klasse. Die OnConfiguring(DbContextOptionsBuilder) -Methode wird aufgerufen, um die Datenbank (und andere Optionen) zu konfigurieren, die für diesen Kontext verwendet werden sollen.

protected DbContext ();
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EF Core isn't fully compatible with trimming, and running the application may generate unexpected runtime failures. Some specific coding pattern are usually required to make trimming work properly, see https://aka.ms/efcore-docs-trimming for more details.")]
protected DbContext ();
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EF Core isn't fully compatible with trimming, and running the application may generate unexpected runtime failures. Some specific coding pattern are usually required to make trimming work properly, see https://aka.ms/efcore-docs-trimming for more details.")]
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("EF Core isn't fully compatible with NativeAOT, and running the application may generate unexpected runtime failures.")]
protected DbContext ();
Protected Sub New ()
Attribute

Hinweise

Weitere Informationen und Beispiele finden Sie unter Lebensdauer, Konfiguration und Initialisierung von DbContext .

Gilt für:

DbContext(DbContextOptions)

Initialisiert eine neue instance der DbContext -Klasse unter Verwendung der angegebenen Optionen. Die OnConfiguring(DbContextOptionsBuilder) -Methode wird weiterhin aufgerufen, um eine weitere Konfiguration der Optionen zu ermöglichen.

public DbContext (Microsoft.EntityFrameworkCore.DbContextOptions options);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EF Core isn't fully compatible with trimming, and running the application may generate unexpected runtime failures. Some specific coding pattern are usually required to make trimming work properly, see https://aka.ms/efcore-docs-trimming for more details.")]
public DbContext (Microsoft.EntityFrameworkCore.DbContextOptions options);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EF Core isn't fully compatible with trimming, and running the application may generate unexpected runtime failures. Some specific coding pattern are usually required to make trimming work properly, see https://aka.ms/efcore-docs-trimming for more details.")]
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("EF Core isn't fully compatible with NativeAOT, and running the application may generate unexpected runtime failures.")]
public DbContext (Microsoft.EntityFrameworkCore.DbContextOptions options);
new Microsoft.EntityFrameworkCore.DbContext : Microsoft.EntityFrameworkCore.DbContextOptions -> Microsoft.EntityFrameworkCore.DbContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EF Core isn't fully compatible with trimming, and running the application may generate unexpected runtime failures. Some specific coding pattern are usually required to make trimming work properly, see https://aka.ms/efcore-docs-trimming for more details.")>]
new Microsoft.EntityFrameworkCore.DbContext : Microsoft.EntityFrameworkCore.DbContextOptions -> Microsoft.EntityFrameworkCore.DbContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EF Core isn't fully compatible with trimming, and running the application may generate unexpected runtime failures. Some specific coding pattern are usually required to make trimming work properly, see https://aka.ms/efcore-docs-trimming for more details.")>]
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("EF Core isn't fully compatible with NativeAOT, and running the application may generate unexpected runtime failures.")>]
new Microsoft.EntityFrameworkCore.DbContext : Microsoft.EntityFrameworkCore.DbContextOptions -> Microsoft.EntityFrameworkCore.DbContext
Public Sub New (options As DbContextOptions)

Parameter

options
DbContextOptions

Die Optionen für diesen Kontext.

Attribute

Hinweise

Weitere Informationen und Beispiele finden Sie unter Lebensdauer, Konfiguration und Initialisierung von DbContextund Verwenden von DbContextOptions .

Gilt für: