Share via


RelationalOptionsExtension Class

Definition

Represents options managed by the relational database providers. These options are set using DbContextOptionsBuilder.

public abstract class RelationalOptionsExtension : Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptionsExtension
type RelationalOptionsExtension = class
    interface IDbContextOptionsExtension
Public MustInherit Class RelationalOptionsExtension
Implements IDbContextOptionsExtension
Inheritance
RelationalOptionsExtension
Implements

Remarks

Instances of this class are designed to be immutable. To change an option, call one of the 'With...' methods to obtain a new instance with the option changed.

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

Constructors

RelationalOptionsExtension()

Creates a new set of options with everything set to default values.

RelationalOptionsExtension(RelationalOptionsExtension)

Called by a derived class constructor when implementing the Clone() method.

Properties

CommandTimeout

The command timeout, or null if none has been set.

Connection

The DbConnection, or null if a connection string was used instead of the full connection object.

ConnectionString

The connection string, or null if a DbConnection was used instead of a connection string.

ExecutionStrategyFactory

A factory for creating the default IExecutionStrategy, or null if none has been configured.

Info

Information/metadata about the extension.

IsConnectionOwned

true if the Connection is owned by the context and should be disposed appropriately.

LogFragment

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

MaxBatchSize

The maximum number of statements that will be included in commands sent to the database during SaveChanges() or null if none has been set.

MigrationsAssembly

The name of the assembly that contains migrations, or null if none has been set.

MigrationsHistoryTableName

The table name to use for the migrations history table, or null if none has been set.

MigrationsHistoryTableSchema

The schema to use for the migrations history table, or null if none has been set.

MinBatchSize

The minimum number of statements that are needed for a multi-statement command sent to the database during SaveChanges() or null if none has been set.

QuerySplittingBehavior

The QuerySplittingBehavior to use when loading related collections in a query.

UseRelationalNulls

Indicates whether or not to use relational database semantics when comparing null values. By default, Entity Framework will use C# semantics for null values, and generate SQL to compensate for differences in how the database handles nulls.

Methods

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.

Clone()

Override this method in a derived class to ensure that any clone created is also of that class.

Extract(IDbContextOptions)

Finds an existing RelationalOptionsExtension registered on the given options or throws if none has been registered. This is typically used to find some relational configuration when it is known that a relational provider is being used.

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.

WithCommandTimeout(Nullable<Int32>)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithConnection(DbConnection, Boolean)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithConnection(DbConnection)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithConnectionString(String)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithDefaultWarningConfiguration(CoreOptionsExtension)

Adds default WarningBehavior for relational events.

WithExecutionStrategyFactory(Func<ExecutionStrategyDependencies,IExecutionStrategy>)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithMaxBatchSize(Nullable<Int32>)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithMigrationsAssembly(String)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithMigrationsHistoryTableName(String)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithMigrationsHistoryTableSchema(String)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithMinBatchSize(Nullable<Int32>)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithUseQuerySplittingBehavior(QuerySplittingBehavior)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithUseRelationalNulls(Boolean)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

Applies to