Table of Contents

Interface IDbContextOptions

Namespace
Microsoft.EntityFrameworkCore.Infrastructure
Assembly
Microsoft.EntityFrameworkCore.dll

The options to be used by a DbContext. You normally override OnConfiguring(DbContextOptionsBuilder) or use a DbContextOptionsBuilder to create instances of classes that implement this interface, they are not designed to be directly created in your application code.

public interface IDbContextOptions
Extension Methods

Remarks

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

See Implementation of database providers and extensions for more information and examples.

Properties

Extensions

Gets the extensions that store the configured options.

IEnumerable<IDbContextOptionsExtension> Extensions { get; }

Property Value

IEnumerable<IDbContextOptionsExtension>

Methods

FindExtension<TExtension>()

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

TExtension? FindExtension<TExtension>() where TExtension : class, IDbContextOptionsExtension

Returns

TExtension

The extension, or null if none was found.

Type Parameters

TExtension

The type of the extension to get.