DbContext 建構函式
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
DbContext() |
初始化 DbContext 類別的新執行個體。 OnConfiguring(DbContextOptionsBuilder)系統會呼叫 方法,以設定資料庫 (和其他選項,) 用於此內容。 |
DbContext(DbContextOptions) |
使用指定的選項, DbContext 初始化 類別的新實例。 OnConfiguring(DbContextOptionsBuilder)仍然會呼叫 方法,以允許進一步設定選項。 |
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
初始化 DbContext 類別的新執行個體。 OnConfiguring(DbContextOptionsBuilder)系統會呼叫 方法,以設定資料庫 (和其他選項,) 用於此內容。
C#
protected DbContext ();
C#
[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 ();
C#
[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 ()
- 屬性
備註
如需詳細資訊 和範例,請參閱 DbCoNtext 存留期、組態和初始化 。
適用於
Entity Framework Core 9.0 和其他版本
產品 | 版本 |
---|---|
Entity Framework Core | 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0 |
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
- 來源:
- DbContext.cs
使用指定的選項, DbContext 初始化 類別的新實例。 OnConfiguring(DbContextOptionsBuilder)仍然會呼叫 方法,以允許進一步設定選項。
C#
public DbContext (Microsoft.EntityFrameworkCore.DbContextOptions options);
C#
[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);
C#
[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)
參數
- options
- DbContextOptions
此內容的選項。
- 屬性
備註
如需詳細資訊 和範例,請參閱 DbCoNtext 存留期、組態和初始化 和使用 DbCoNtextOptions 。
適用於
Entity Framework Core 9.0 和其他版本
產品 | 版本 |
---|---|
Entity Framework Core | 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0 |