RelationalDbContextOptionsBuilder<TBuilder, TExtension> RelationalDbContextOptionsBuilder(Of TBuilder, TExtension) Class

Definition

Allows relational database specific configuration to be performed on DbContextOptions.

Instances of this class are typically returned from methods that configure the context to use a particular relational database provider.

public abstract class RelationalDbContextOptionsBuilder<TBuilder, TExtension>
    where TBuilder : RelationalDbContextOptionsBuilder<TBuilder, TExtension> where TExtension : RelationalOptionsExtension
Public MustInherit Class RelationalDbContextOptionsBuilder(Of TBuilder As RelationalDbContextOptionsBuilder(Of TBuilder, TExtension), TExtension As RelationalOptionsExtension)
Type Parameters
TBuilder
TExtension
Inheritance
System.ObjectSystem.Object
RelationalDbContextOptionsBuilder<TBuilder, TExtension>RelationalDbContextOptionsBuilder(Of TBuilder, TExtension)

Inherited Members

System.Object

System.Object.ToString()System.Object.ToString()
System.Object.Equals(System.Object)System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()System.Object.GetHashCode()
System.Object.GetType()System.Object.GetType()
System.Object.MemberwiseClone()System.Object.MemberwiseClone()

Constructors

RelationalDbContextOptionsBuilder(DbContextOptionsBuilder) RelationalDbContextOptionsBuilder(DbContextOptionsBuilder)

Initializes a new instance of the RelationalDbContextOptionsBuilder<TBuilder, TExtension> class.

protected RelationalDbContextOptionsBuilder(DbContextOptionsBuilder optionsBuilder)
Protected Sub New(optionsBuilder As DbContextOptionsBuilder)
Parameters
optionsBuilder
DbContextOptionsBuilder DbContextOptionsBuilder

The core options builder.

Properties

OptionsBuilder OptionsBuilder

Gets the core options builder.

protected virtual DbContextOptionsBuilder OptionsBuilder { get; }
Protected Overridable ReadOnly Property OptionsBuilder As DbContextOptionsBuilder

Methods

CloneExtension() CloneExtension()

Clones the configuration in this builder.

protected abstract TExtension CloneExtension()
Protected MustOverride Function CloneExtension As TExtension
Returns
TExtension TExtension

The cloned configuration.

CommandTimeout(Nullable) CommandTimeout(Nullable(Of Int32))

Configures the wait time (in seconds) before terminating the attempt to execute a command and generating an error.

public virtual TBuilder CommandTimeout(int ? commandTimeout)
Public Overridable Function CommandTimeout(commandTimeout As Integer?) As TBuilder
Parameters
commandTimeout
System.Nullable<System.Int32> System.Nullable(Of System.Int32)

The time in seconds to wait for the command to execute.

Returns
TBuilder TBuilder

The same builder instance so that multiple calls can be chained.

ExecutionStrategy(Func) ExecutionStrategy(Func(Of ExecutionStrategyContext, IExecutionStrategy))

Configures the context to use the provided IExecutionStrategy.

public virtual TBuilder ExecutionStrategy(Func<ExecutionStrategyContext, IExecutionStrategy> getExecutionStrategy)
Public Overridable Function ExecutionStrategy(getExecutionStrategy As Func(Of ExecutionStrategyContext, IExecutionStrategy)) As TBuilder
Parameters
getExecutionStrategy
System.Func<ExecutionStrategyContext, IExecutionStrategy> System.Func(Of ExecutionStrategyContext, IExecutionStrategy)

A function that returns a new instance of an execution strategy.

Returns
TBuilder TBuilder

MaxBatchSize(Int32) MaxBatchSize(Int32)

Configures the maximum number of statements that will be included in commands sent to the database during SaveChanges().

public virtual TBuilder MaxBatchSize(int maxBatchSize)
Public Overridable Function MaxBatchSize(maxBatchSize As Integer) As TBuilder
Parameters
maxBatchSize
System.Int32 System.Int32

The maximum number of statements.

Returns
TBuilder TBuilder

The same builder instance so that multiple calls can be chained.

MigrationsAssembly(String) MigrationsAssembly(String)

Configures the assembly where migrations are maintained for this context.

public virtual TBuilder MigrationsAssembly(string assemblyName)
Public Overridable Function MigrationsAssembly(assemblyName As String) As TBuilder
Parameters
assemblyName
System.String System.String

The name of the assembly.

Returns
TBuilder TBuilder

The same builder instance so that multiple calls can be chained.

MigrationsHistoryTable(String, String) MigrationsHistoryTable(String, String)

Configures the name of the table used to record which migrations have been applied to the database.

public virtual TBuilder MigrationsHistoryTable(string tableName, string schema = null)
Public Overridable Function MigrationsHistoryTable(tableName As String, schema As String = Nothing) As TBuilder
Parameters
tableName
System.String System.String

The name of the table.

schema
System.String System.String

The schema of the table.

Returns
TBuilder TBuilder

The same builder instance so that multiple calls can be chained.

SetOption(Action) SetOption(Action(Of TExtension))

Sets an option by cloning the extension used to store the settings. This ensures the builder does not modify options that are already in use elsewhere.

protected virtual TBuilder SetOption(Action<TExtension> setAction)
Protected Overridable Function SetOption(setAction As Action(Of TExtension)) As TBuilder
Parameters
setAction
System.Action<TExtension> System.Action(Of TExtension)

An action to set the option.

Returns
TBuilder TBuilder

The same builder instance so that multiple calls can be chained.

UseRelationalNulls() UseRelationalNulls()

Configures the context 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.

public virtual TBuilder UseRelationalNulls()
Public Overridable Function UseRelationalNulls As TBuilder
Returns
TBuilder TBuilder

The same builder instance so that multiple calls can be chained.