Table of Contents

Interface IDbContextOptionsExtension

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

Interface for extensions that are stored in Extensions.

This interface is typically used by database providers (and other extensions). It is generally not used in application code.

public interface IDbContextOptionsExtension

Remarks

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

Properties

Info

Information/metadata about the extension.

DbContextOptionsExtensionInfo Info { get; }

Property Value

DbContextOptionsExtensionInfo

Methods

ApplyDefaults(IDbContextOptions)

Gives the extension a chance to configure defaults based on other options. Most extensions do not have dynamic defaults and so this will be a no-op.

IDbContextOptionsExtension ApplyDefaults(IDbContextOptions options)

Parameters

options IDbContextOptions

The options being validated.

Returns

IDbContextOptionsExtension

ApplyServices(IServiceCollection)

Adds the services required to make the selected options work. This is used when there is no external IServiceProvider and EF is maintaining its own service provider internally. This allows database providers (and other extensions) to register their required services when EF is creating an service provider.

void ApplyServices(IServiceCollection services)

Parameters

services IServiceCollection

The collection to add services to.

Validate(IDbContextOptions)

Gives the extension a chance to validate that all options in the extension are valid. Most extensions do not have invalid combinations and so this will be a no-op. If options are invalid, then an exception should be thrown.

void Validate(IDbContextOptions options)

Parameters

options IDbContextOptions

The options being validated.