IDbContextOptionsExtension Interface

Definition

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
type IDbContextOptionsExtension = interface
Public Interface IDbContextOptionsExtension
Derived

Remarks

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

Properties

Info

Information/metadata about the extension.

LogFragment

Creates a message fragment for logging typically containing information about any useful non-default options that have been configured.

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.

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.

GetServiceProviderHashCode()

Returns a hash code created from any options that would cause a new IServiceProvider to be needed. Most extensions do not have any such options and should return zero.

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.

Applies to