DbContext 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| DbContext() |
初始化 DbContext 类的新实例。 OnConfiguring(DbContextOptionsBuilder)将调用该方法以配置要用于此上下文的数据库(和其他选项)。 |
| DbContext(DbContextOptions) |
使用指定的选项初始化类的新实例 DbContext 。 OnConfiguring(DbContextOptionsBuilder)仍会调用该方法以允许进一步配置选项。 |
DbContext()
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- 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)
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- DbContext.cs
- Source:
- 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
此上下文的选项。
- 特性
注解
有关详细信息 和示例,请参阅 DbContext 生存期、配置和初始化 以及 使用 DbContextOptions 。