Table of Contents

Class DbContextOptionsExtensionInfo

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

Information/metadata for an IDbContextOptionsExtension.

public abstract class DbContextOptionsExtensionInfo
Inheritance
DbContextOptionsExtensionInfo
Inherited Members

Remarks

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

Constructors

DbContextOptionsExtensionInfo(IDbContextOptionsExtension)

Creates a new DbContextOptionsExtensionInfo instance containing info/metadata for the given extension.

protected DbContextOptionsExtensionInfo(IDbContextOptionsExtension extension)

Parameters

extension IDbContextOptionsExtension

The extension.

Remarks

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

Properties

Extension

The extension for which this instance contains metadata.

public virtual IDbContextOptionsExtension Extension { get; }

Property Value

IDbContextOptionsExtension

Remarks

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

IsDatabaseProvider

true if the extension is a database provider; false otherwise.

public abstract bool IsDatabaseProvider { get; }

Property Value

bool

Remarks

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

LogFragment

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

public abstract string LogFragment { get; }

Property Value

string

Remarks

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

Methods

GetServiceProviderHashCode()

Returns a hash code created from any options that would cause a new IServiceProvider to be needed. For example, if the options affect a singleton service. However most extensions do not have any such options and should return zero.

public abstract int GetServiceProviderHashCode()

Returns

int

A hash over options that require a new service provider when changed.

Remarks

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

PopulateDebugInfo(IDictionary<string, string>)

Populates a dictionary of information that may change between uses of the extension such that it can be compared to a previous configuration for this option and differences can be logged. The dictionary key should be prefixed by the extension name. For example, "SqlServer:".

public abstract void PopulateDebugInfo(IDictionary<string, string> debugInfo)

Parameters

debugInfo IDictionary<string, string>

The dictionary to populate.

Remarks

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

ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo)

Returns a value indicating whether all of the options used in GetServiceProviderHashCode() are the same as in the given extension.

public abstract bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other)

Parameters

other DbContextOptionsExtensionInfo

The other extension.

Returns

bool

A value indicating whether all of the options that require a new service provider are the same.

Remarks

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