Table of Contents

Class DbContextOptions<TContext>

Namespace
Microsoft.EntityFrameworkCore
Assembly
Microsoft.EntityFrameworkCore.dll

The options to be used by a DbContext. You normally override OnConfiguring(DbContextOptionsBuilder) or use a DbContextOptionsBuilder<TContext> to create instances of this class and it is not designed to be directly constructed in your application code.

public class DbContextOptions<TContext> : DbContextOptions, IDbContextOptions where TContext : DbContext

Type Parameters

TContext

The type of the context these options apply to.

Inheritance
DbContextOptions<TContext>
Implements
Inherited Members
Extension Methods

Remarks

See Using DbContextOptions for more information and examples.

Constructors

DbContextOptions()

Initializes a new instance of the DbContextOptions<TContext> class. You normally override OnConfiguring(DbContextOptionsBuilder) or use a DbContextOptionsBuilder<TContext> to create instances of this class and it is not designed to be directly constructed in your application code.

public DbContextOptions()

DbContextOptions(IReadOnlyDictionary<Type, IDbContextOptionsExtension>)

Initializes a new instance of the DbContextOptions<TContext> class. You normally override OnConfiguring(DbContextOptionsBuilder) or use a DbContextOptionsBuilder<TContext> to create instances of this class and it is not designed to be directly constructed in your application code.

public DbContextOptions(IReadOnlyDictionary<Type, IDbContextOptionsExtension> extensions)

Parameters

extensions IReadOnlyDictionary<Type, IDbContextOptionsExtension>

The extensions that store the configured options.

Properties

ContextType

The type of context that these options are for (TContext).

public override Type ContextType { get; }

Property Value

Type

Methods

WithExtension<TExtension>(TExtension)

public override DbContextOptions WithExtension<TExtension>(TExtension extension) where TExtension : class, IDbContextOptionsExtension

Parameters

extension TExtension

Returns

DbContextOptions

Type Parameters

TExtension