Share via


SqlServerDbContextOptionsExtensions.ConfigureSqlEngine Method

Definition

Overloads

ConfigureSqlEngine(DbContextOptionsBuilder, Action<SqlEngineDbContextOptionsBuilder>)

Configures the context to connect to any of SQL Server, Azure SQL, Azure Synapse databases, but without initially setting any DbConnection or connection string.

ConfigureSqlEngine<TContext>(DbContextOptionsBuilder<TContext>, Action<SqlEngineDbContextOptionsBuilder>)

Configures the context to connect to any of SQL Server, Azure SQL, Azure Synapse databases, but without initially setting any DbConnection or connection string.

ConfigureSqlEngine(DbContextOptionsBuilder, Action<SqlEngineDbContextOptionsBuilder>)

Source:
SqlServerDbContextOptionsBuilderExtensions.cs

Configures the context to connect to any of SQL Server, Azure SQL, Azure Synapse databases, but without initially setting any DbConnection or connection string.

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder ConfigureSqlEngine (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqlEngineDbContextOptionsBuilder>? sqlEngineOptionsAction = default);
static member ConfigureSqlEngine : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder * Action<Microsoft.EntityFrameworkCore.Infrastructure.SqlEngineDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
<Extension()>
Public Function ConfigureSqlEngine (optionsBuilder As DbContextOptionsBuilder, Optional sqlEngineOptionsAction As Action(Of SqlEngineDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder

Parameters

optionsBuilder
DbContextOptionsBuilder

The builder being used to configure the context.

sqlEngineOptionsAction
Action<SqlEngineDbContextOptionsBuilder>

An optional action to allow additional SQL Server, Azure SQL, Azure Synapse configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

The connection or connection string must be set before the DbContext is used to connect to a database. Set a connection using SetDbConnection(DatabaseFacade, DbConnection, Boolean). Set a connection string using SetConnectionString(DatabaseFacade, String).

See Using DbContextOptions, and Accessing SQL Server, Azure SQL, Azure Synapse databases with EF Core for more information and examples.

Applies to

ConfigureSqlEngine<TContext>(DbContextOptionsBuilder<TContext>, Action<SqlEngineDbContextOptionsBuilder>)

Source:
SqlServerDbContextOptionsBuilderExtensions.cs

Configures the context to connect to any of SQL Server, Azure SQL, Azure Synapse databases, but without initially setting any DbConnection or connection string.

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> ConfigureSqlEngine<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqlEngineDbContextOptionsBuilder>? sqlEngineOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
static member ConfigureSqlEngine : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> * Action<Microsoft.EntityFrameworkCore.Infrastructure.SqlEngineDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)
<Extension()>
Public Function ConfigureSqlEngine(Of TContext As DbContext) (optionsBuilder As DbContextOptionsBuilder(Of TContext), Optional sqlEngineOptionsAction As Action(Of SqlEngineDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder(Of TContext)

Type Parameters

TContext

Parameters

optionsBuilder
DbContextOptionsBuilder<TContext>

The builder being used to configure the context.

sqlEngineOptionsAction
Action<SqlEngineDbContextOptionsBuilder>

An optional action to allow additional SQL Server, Azure SQL, Azure Synapse configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

The connection or connection string must be set before the DbContext is used to connect to a database. Set a connection using SetDbConnection(DatabaseFacade, DbConnection, Boolean). Set a connection string using SetConnectionString(DatabaseFacade, String).

See Using DbContextOptions, and Accessing SQL Server, Azure SQL, Azure Synapse databases with EF Core for more information and examples.

Applies to