Bagikan melalui


DbContext Konstruktor

Definisi

Overload

DbContext()

Menginisialisasi instans baru kelas DbContext. Metode OnConfiguring(DbContextOptionsBuilder) ini akan dipanggil untuk mengonfigurasi database (dan opsi lain) yang akan digunakan untuk konteks ini.

DbContext(DbContextOptions)

Menginisialisasi instans DbContext baru kelas menggunakan opsi yang ditentukan. Metode OnConfiguring(DbContextOptionsBuilder) ini masih akan dipanggil untuk memungkinkan konfigurasi opsi lebih lanjut.

DbContext()

Menginisialisasi instans baru kelas DbContext. Metode OnConfiguring(DbContextOptionsBuilder) ini akan dipanggil untuk mengonfigurasi database (dan opsi lain) yang akan digunakan untuk konteks ini.

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

Keterangan

Lihat Masa pakai, konfigurasi, dan inisialisasi DbContext untuk informasi dan contoh selengkapnya.

Berlaku untuk

DbContext(DbContextOptions)

Menginisialisasi instans DbContext baru kelas menggunakan opsi yang ditentukan. Metode OnConfiguring(DbContextOptionsBuilder) ini masih akan dipanggil untuk memungkinkan konfigurasi opsi lebih lanjut.

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

Opsi untuk konteks ini.

Atribut

Keterangan

Lihat Masa pakai, konfigurasi, dan inisialisasi DbContextOptions dan Menggunakan DbContextOptions untuk informasi dan contoh selengkapnya.

Berlaku untuk