Язык

DbContext Конструкторы

Определение

Перегрузки

Имя. Описание
DbContext()

Инициализирует новый экземпляр класса DbContext. Метод OnConfiguring(DbContextOptionsBuilder) будет вызван для настройки базы данных (и других параметров), используемых для этого контекста.

DbContext(DbContextOptions)

Инициализирует новый экземпляр DbContext класса с помощью указанных параметров. Метод OnConfiguring(DbContextOptionsBuilder) по-прежнему вызывается, чтобы разрешить дальнейшую настройку параметров.

DbContext()

Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs

Инициализирует новый экземпляр класса DbContext. Метод OnConfiguring(DbContextOptionsBuilder) будет вызван для настройки базы данных (и других параметров), используемых для этого контекста.

protected DbContext();
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("EF Core isn't fully compatible with NativeAOT, and running the application may generate unexpected runtime failures.")]
[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.")]
protected DbContext();
Protected Sub New ()
Атрибуты

Комментарии

Дополнительные сведения и примеры см. в статье о времени существования, конфигурации и инициализации DbContext .

Применяется к

DbContext(DbContextOptions)

Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs
Исходный код:
DbContext.cs

Инициализирует новый экземпляр DbContext класса с помощью указанных параметров. Метод OnConfiguring(DbContextOptionsBuilder) по-прежнему вызывается, чтобы разрешить дальнейшую настройку параметров.

public DbContext(Microsoft.EntityFrameworkCore.DbContextOptions options);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("EF Core isn't fully compatible with NativeAOT, and running the application may generate unexpected runtime failures.")]
[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.")]
public DbContext(Microsoft.EntityFrameworkCore.DbContextOptions options);
new Microsoft.EntityFrameworkCore.DbContext : Microsoft.EntityFrameworkCore.DbContextOptions -> Microsoft.EntityFrameworkCore.DbContext
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("EF Core isn't fully compatible with NativeAOT, and running the application may generate unexpected runtime failures.")>]
[<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.")>]
new Microsoft.EntityFrameworkCore.DbContext : Microsoft.EntityFrameworkCore.DbContextOptions -> Microsoft.EntityFrameworkCore.DbContext
Public Sub New (options As DbContextOptions)

Параметры

options
DbContextOptions

Параметры этого контекста.

Атрибуты

Комментарии

Дополнительные сведения и примеры см. в статье о времени существования, конфигурации и инициализацииDbContextOptions и использовании DbContextOptions .

Применяется к