Udostępnij za pośrednictwem


DbContext Konstruktory

Definicja

Przeciążenia

DbContext()

Inicjuje nowe wystąpienie klasy DbContext. Metoda OnConfiguring(DbContextOptionsBuilder) zostanie wywołana w celu skonfigurowania bazy danych (i innych opcji) do użycia w tym kontekście.

DbContext(DbContextOptions)

Inicjuje DbContext nowe wystąpienie klasy przy użyciu określonych opcji. Metoda OnConfiguring(DbContextOptionsBuilder) będzie nadal wywoływana, aby umożliwić dalszą konfigurację opcji.

DbContext()

Inicjuje nowe wystąpienie klasy DbContext. Metoda OnConfiguring(DbContextOptionsBuilder) zostanie wywołana w celu skonfigurowania bazy danych (i innych opcji) do użycia w tym kontekście.

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 ()
Atrybuty

Uwagi

Aby uzyskać więcej informacji i przykładów , zobacz DbContext lifetime, configuration and initialization (Okres istnienia, konfiguracja i inicjowanie tekstu DbContext ).

Dotyczy

DbContext(DbContextOptions)

Inicjuje DbContext nowe wystąpienie klasy przy użyciu określonych opcji. Metoda OnConfiguring(DbContextOptionsBuilder) będzie nadal wywoływana, aby umożliwić dalszą konfigurację opcji.

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)

Parametry

options
DbContextOptions

Opcje dla tego kontekstu.

Atrybuty

Uwagi

Aby uzyskać więcej informacji i przykładów , zobacz DbContextOptions okres istnienia, konfigurację i inicjację oraz Używanie elementu DbContextOptions .

Dotyczy