SqlServerDbContextOptionsBuilder SqlServerDbContextOptionsBuilder Class

Definition

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.

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

Inherited Members

Microsoft.EntityFrameworkCore.Infrastructure.RelationalDbContextOptionsBuilder{Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder,Microsoft.EntityFrameworkCore.Infrastructure.Internal.SqlServerOptionsExtension}

Microsoft.EntityFrameworkCore.Infrastructure.RelationalDbContextOptionsBuilder<Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder, Microsoft.EntityFrameworkCore.Infrastructure.Internal.SqlServerOptionsExtension>.OptionsBuilderMicrosoft.EntityFrameworkCore.Infrastructure.RelationalDbContextOptionsBuilder<Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder, Microsoft.EntityFrameworkCore.Infrastructure.Internal.SqlServerOptionsExtension>.OptionsBuilder
MaxBatchSize(System.Int32)MaxBatchSize(System.Int32)
CommandTimeout(System.Nullable<System.Int32>)CommandTimeout(System.Nullable(Of System.Int32))
MigrationsAssembly(System.String)MigrationsAssembly(System.String)
MigrationsHistoryTable(System.String, System.String)MigrationsHistoryTable(System.String, System.String)

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

SqlServerDbContextOptionsBuilder(DbContextOptionsBuilder) SqlServerDbContextOptionsBuilder(DbContextOptionsBuilder)

Initializes a new instance of the SqlServerDbContextOptionsBuilder class.

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

The options builder.

Methods

CloneExtension() CloneExtension()

Clones the configuration in this builder.

protected override SqlServerOptionsExtension CloneExtension()
Protected Overrides Function CloneExtension As SqlServerOptionsExtension
Returns
Overrides
Microsoft.EntityFrameworkCore.Infrastructure.RelationalDbContextOptionsBuilder<Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder, Microsoft.EntityFrameworkCore.Infrastructure.Internal.SqlServerOptionsExtension>.CloneExtension()Microsoft.EntityFrameworkCore.Infrastructure.RelationalDbContextOptionsBuilder<Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder, Microsoft.EntityFrameworkCore.Infrastructure.Internal.SqlServerOptionsExtension>.CloneExtension()

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) 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<System.Int32> System.Collections.Generic.ICollection(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