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

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.

Syntax

Declaration

public abstract class RelationalDbContextOptionsBuilder<TBuilder, TExtension>
    where TBuilder : RelationalDbContextOptionsBuilder<TBuilder, TExtension> where TExtension : RelationalOptionsExtensionPublic MustInherit Class RelationalDbContextOptionsBuilder(Of TBuilder As RelationalDbContextOptionsBuilder(Of TBuilder, TExtension), TExtension As RelationalOptionsExtension)

Type Parameters

TBuilder
TExtension

Inheritance Hierarchy

  • System.Object
    System.Object
  • RelationalDbContextOptionsBuilder<TBuilder, TExtension>
    RelationalDbContextOptionsBuilder(Of TBuilder, TExtension)

Inherited Members

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

Constructors summary

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

Properties summary

Gets the core options builder.

Methods summary

Clones the configuration in this builder.

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

Configures the context to use the provided IExecutionStrategy.

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

Configures the assembly where migrations are maintained for this context.

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

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.

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.

Constructors

Properties

  • OptionsBuilder
    OptionsBuilder

    Gets the core options builder.

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

    Property Value

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<Int32>)
    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<T><System.Int32>
      System.Nullable<T>(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<ExecutionStrategyContext, IExecutionStrategy>)
    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

    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<TExtension>)
    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<T><TExtension>
      System.Action<T>(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.

Details

Assembly

Microsoft.EntityFrameworkCore.Relational.dll