SqlServerDbContextOptionsBuilder SqlServerDbContextOptionsBuilder Class

Allows SQL Server specific configuration to be performed on DbContextOptions.

Instances of this class are returned from a call to UseSqlServer(DbContextOptionsBuilder, String, Action<SqlServerDbContextOptionsBuilder>) and it is not designed to be directly constructed in your application code.

Syntax

Declaration

public class SqlServerDbContextOptionsBuilder : RelationalDbContextOptionsBuilder<SqlServerDbContextOptionsBuilder, SqlServerOptionsExtension>Public Class SqlServerDbContextOptionsBuilder
    Inherits RelationalDbContextOptionsBuilder(Of SqlServerDbContextOptionsBuilder, SqlServerOptionsExtension)

Inheritance Hierarchy

Inherited Members

OptionsBuilder,
OptionsBuilder,
CloneExtension(),
CloneExtension(),
MaxBatchSize(Int32),
MaxBatchSize(Int32),
CommandTimeout(Nullable<Int32>),
CommandTimeout(Nullable(Of Int32)),
MigrationsAssembly(String),
MigrationsAssembly(String),
MigrationsHistoryTable(String, String),
MigrationsHistoryTable(String, String),
UseRelationalNulls(),
UseRelationalNulls(),
ExecutionStrategy(Func<ExecutionStrategyContext, IExecutionStrategy>),
ExecutionStrategy(Func(Of ExecutionStrategyContext, IExecutionStrategy)),
SetOption(Action<SqlServerOptionsExtension>),
SetOption(Action(Of SqlServerOptionsExtension)),
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 SqlServerDbContextOptionsBuilder class.

Methods summary

Clones the configuration in this builder.

Configures the context to use the default retrying IExecutionStrategy.

Configures the context to use the default retrying IExecutionStrategy.

Configures the context to use the default retrying IExecutionStrategy.

Use a ROW_NUMBER() in queries instead of OFFSET/FETCH. This method is backwards-compatible to SQL Server 2005.

Constructors

  • SqlServerDbContextOptionsBuilder(DbContextOptionsBuilder)
    SqlServerDbContextOptionsBuilder(DbContextOptionsBuilder)

    Initializes a new instance of the SqlServerDbContextOptionsBuilder class.

    public SqlServerDbContextOptionsBuilder(DbContextOptionsBuilder optionsBuilder)Public Sub New(optionsBuilder As DbContextOptionsBuilder)

    Parameters

Methods

  • CloneExtension()
    CloneExtension()

    Clones the configuration in this builder.

    protected override SqlServerOptionsExtension CloneExtension()Protected Overrides Function CloneExtension As SqlServerOptionsExtension

    Returns

  • EnableRetryOnFailure()
    EnableRetryOnFailure()

    Configures the context to use the default retrying IExecutionStrategy.

    public virtual SqlServerDbContextOptionsBuilder EnableRetryOnFailure()Public Overridable Function EnableRetryOnFailure As SqlServerDbContextOptionsBuilder

    Returns

  • EnableRetryOnFailure(Int32)
    EnableRetryOnFailure(Int32)

    Configures the context to use the default retrying IExecutionStrategy.

    public virtual SqlServerDbContextOptionsBuilder EnableRetryOnFailure(int maxRetryCount)Public Overridable Function EnableRetryOnFailure(maxRetryCount As Integer) As SqlServerDbContextOptionsBuilder

    Parameters

    • maxRetryCount
      System.Int32
      System.Int32

    Returns

  • EnableRetryOnFailure(Int32, TimeSpan, ICollection<Int32>)
    EnableRetryOnFailure(Int32, TimeSpan, ICollection(Of Int32))

    Configures the context to use the default retrying IExecutionStrategy.

    public virtual SqlServerDbContextOptionsBuilder EnableRetryOnFailure(int maxRetryCount, TimeSpan maxRetryDelay, ICollection<int> errorNumbersToAdd)Public Overridable Function EnableRetryOnFailure(maxRetryCount As Integer, maxRetryDelay As TimeSpan, errorNumbersToAdd As ICollection(Of Integer)) As SqlServerDbContextOptionsBuilder

    Parameters

    • maxRetryCount
      System.Int32
      System.Int32

      The maximum number of retry attempts.

    • maxRetryDelay
      System.TimeSpan
      System.TimeSpan

      The maximum delay in milliseconds between retries.

    • errorNumbersToAdd
      System.Collections.Generic.ICollection<T><System.Int32>
      System.Collections.Generic.ICollection<T>(Of System.Int32)

      Additional SQL error numbers that should be considered transient.

    Returns

  • UseRowNumberForPaging()
    UseRowNumberForPaging()

    Use a ROW_NUMBER() in queries instead of OFFSET/FETCH. This method is backwards-compatible to SQL Server 2005.

    public virtual void UseRowNumberForPaging()Public Overridable Sub UseRowNumberForPaging

Details

Assembly

Microsoft.EntityFrameworkCore.SqlServer.dll