Condividi tramite


DbContext Costruttori

Definizione

Overload

DbContext()

Inizializza una nuova istanza della classe DbContext. Il OnConfiguring(DbContextOptionsBuilder) metodo verrà chiamato per configurare il database (e altre opzioni) da usare per questo contesto.

DbContext(DbContextOptions)

Inizializza una nuova istanza della DbContext classe utilizzando le opzioni specificate. Il OnConfiguring(DbContextOptionsBuilder) metodo verrà comunque chiamato per consentire un'ulteriore configurazione delle opzioni.

DbContext()

Inizializza una nuova istanza della classe DbContext. Il OnConfiguring(DbContextOptionsBuilder) metodo verrà chiamato per configurare il database (e altre opzioni) da usare per questo contesto.

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

Commenti

Per altre informazioni ed esempi , vedere Durata, configurazione e inizializzazione di DbContext .

Si applica a

DbContext(DbContextOptions)

Inizializza una nuova istanza della DbContext classe utilizzando le opzioni specificate. Il OnConfiguring(DbContextOptionsBuilder) metodo verrà comunque chiamato per consentire un'ulteriore configurazione delle opzioni.

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)

Parametri

options
DbContextOptions

Opzioni per questo contesto.

Attributi

Commenti

Per altre informazioni ed esempi , vedere Durata, configurazione e inizializzazione di DbContexte Uso di DbContextOptions .

Si applica a