DbContextOptions Class

Definition

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

public abstract class DbContextOptions : Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptions
type DbContextOptions = class
    interface IDbContextOptions
Public MustInherit Class DbContextOptions
Implements IDbContextOptions
Inheritance
DbContextOptions
Derived
Implements

Constructors

DbContextOptions(IReadOnlyDictionary<Type,IDbContextOptionsExtension>)

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

Properties

ContextType

The type of context that these options are for. Will return DbContext if the options are not built for a specific derived context.

Extensions

Gets the extensions that store the configured options.

IsFrozen

Returns true if Freeze() has been called. A frozen options object cannot be further configured with OnConfiguring(DbContextOptionsBuilder).

Methods

FindExtension<TExtension>()

Gets the extension of the specified type. Returns null if no extension of the specified type is configured.

Freeze()

Specifies that no further configuration of this options object should occur.

GetExtension<TExtension>()

Gets the extension of the specified type. Throws if no extension of the specified type is configured.

WithExtension<TExtension>(TExtension)

Adds the given extension to the underlying options and creates a new DbContextOptions with the extension added.

Applies to