DbContext Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
DbContext() |
Initializes a new instance of the DbContext class. The OnConfiguring(DbContextOptionsBuilder) method will be called to configure the database (and other options) to be used for this context. |
DbContext(DbContextOptions) |
Initializes a new instance of the DbContext class using the specified options. The OnConfiguring(DbContextOptionsBuilder) method will still be called to allow further configuration of the options. |
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
Initializes a new instance of the DbContext class. The OnConfiguring(DbContextOptionsBuilder) method will be called to configure the database (and other options) to be used for this context.
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 ()
- Attributes
Remarks
See DbContext lifetime, configuration, and initialization for more information and examples.
Applies to
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
Initializes a new instance of the DbContext class using the specified options. The OnConfiguring(DbContextOptionsBuilder) method will still be called to allow further configuration of the options.
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)
Parameters
- options
- DbContextOptions
The options for this context.
- Attributes
Remarks
See DbContext lifetime, configuration, and initialization and Using DbContextOptions for more information and examples.
Applies to
Entity Framework