SqlServerDbContextOptionsExtensions SqlServerDbContextOptionsExtensions Class

SQL Server specific extension methods for DbContextOptionsBuilder.

Syntax

Declaration

public static class SqlServerDbContextOptionsExtensionsPublic Module SqlServerDbContextOptionsExtensions

Inheritance Hierarchy

  • System.Object
    System.Object
  • SqlServerDbContextOptionsExtensions
    SqlServerDbContextOptionsExtensions

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()

Methods summary

Configures the context to connect to a Microsoft SQL Server database.

Configures the context to connect to a Microsoft SQL Server database.

Configures the context to connect to a Microsoft SQL Server database.

Configures the context to connect to a Microsoft SQL Server database.

Methods

  • UseSqlServer(DbContextOptionsBuilder, DbConnection, Action<SqlServerDbContextOptionsBuilder>)
    UseSqlServer(DbContextOptionsBuilder, DbConnection, Action(Of SqlServerDbContextOptionsBuilder))

    Configures the context to connect to a Microsoft SQL Server database.

    public static DbContextOptionsBuilder UseSqlServer(this DbContextOptionsBuilder optionsBuilder, DbConnection connection, Action<SqlServerDbContextOptionsBuilder> sqlServerOptionsAction = null)<ExtensionAttribute>
    Public Shared Function UseSqlServer(optionsBuilder As DbContextOptionsBuilder, connection As DbConnection, sqlServerOptionsAction As Action(Of SqlServerDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder

    Parameters

    • optionsBuilder

      The builder being used to configure the context.

    • connection
      System.Data.Common.DbConnection
      System.Data.Common.DbConnection

      An existing System.Data.Common.DbConnection to be used to connect to the database. If the connection is in the open state then EF will not open or close the connection. If the connection is in the closed state then EF will open and close the connection as needed.

    • sqlServerOptionsAction

      An optional action to allow additional SQL Server specific configuration.

    Returns

  • UseSqlServer(DbContextOptionsBuilder, String, Action<SqlServerDbContextOptionsBuilder>)
    UseSqlServer(DbContextOptionsBuilder, String, Action(Of SqlServerDbContextOptionsBuilder))

    Configures the context to connect to a Microsoft SQL Server database.

    public static DbContextOptionsBuilder UseSqlServer(this DbContextOptionsBuilder optionsBuilder, string connectionString, Action<SqlServerDbContextOptionsBuilder> sqlServerOptionsAction = null)<ExtensionAttribute>
    Public Shared Function UseSqlServer(optionsBuilder As DbContextOptionsBuilder, connectionString As String, sqlServerOptionsAction As Action(Of SqlServerDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder

    Parameters

    Returns

  • UseSqlServer<TContext>(DbContextOptionsBuilder<TContext>, DbConnection, Action<SqlServerDbContextOptionsBuilder>)
    UseSqlServer(Of TContext)(DbContextOptionsBuilder(Of TContext), DbConnection, Action(Of SqlServerDbContextOptionsBuilder))

    Configures the context to connect to a Microsoft SQL Server database.

    public static DbContextOptionsBuilder<TContext> UseSqlServer<TContext>(this DbContextOptionsBuilder<TContext> optionsBuilder, DbConnection connection, Action<SqlServerDbContextOptionsBuilder> sqlServerOptionsAction = null)where TContext : DbContext<ExtensionAttribute>
    Public Shared Function UseSqlServer(Of TContext As DbContext)(optionsBuilder As DbContextOptionsBuilder(Of TContext), connection As DbConnection, sqlServerOptionsAction As Action(Of SqlServerDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder(Of TContext)

    Parameters

    • optionsBuilder

      The builder being used to configure the context.

    • connection
      System.Data.Common.DbConnection
      System.Data.Common.DbConnection

      An existing System.Data.Common.DbConnection to be used to connect to the database. If the connection is in the open state then EF will not open or close the connection. If the connection is in the closed state then EF will open and close the connection as needed.

    • sqlServerOptionsAction

      An optional action to allow additional SQL Server specific configuration.

    Returns

  • UseSqlServer<TContext>(DbContextOptionsBuilder<TContext>, String, Action<SqlServerDbContextOptionsBuilder>)
    UseSqlServer(Of TContext)(DbContextOptionsBuilder(Of TContext), String, Action(Of SqlServerDbContextOptionsBuilder))

    Configures the context to connect to a Microsoft SQL Server database.

    public static DbContextOptionsBuilder<TContext> UseSqlServer<TContext>(this DbContextOptionsBuilder<TContext> optionsBuilder, string connectionString, Action<SqlServerDbContextOptionsBuilder> sqlServerOptionsAction = null)where TContext : DbContext<ExtensionAttribute>
    Public Shared Function UseSqlServer(Of TContext As DbContext)(optionsBuilder As DbContextOptionsBuilder(Of TContext), connectionString As String, sqlServerOptionsAction As Action(Of SqlServerDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder(Of TContext)

    Parameters

    Returns

Details

Assembly

Microsoft.EntityFrameworkCore.SqlServer.dll