RelationalOptionsExtension.WithConnection Method

Definition

Overloads

WithConnection(DbConnection)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithConnection(DbConnection, Boolean)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

WithConnection(DbConnection)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

public virtual Microsoft.EntityFrameworkCore.Infrastructure.RelationalOptionsExtension WithConnection (System.Data.Common.DbConnection connection);
public virtual Microsoft.EntityFrameworkCore.Infrastructure.RelationalOptionsExtension WithConnection (System.Data.Common.DbConnection? connection);
abstract member WithConnection : System.Data.Common.DbConnection -> Microsoft.EntityFrameworkCore.Infrastructure.RelationalOptionsExtension
override this.WithConnection : System.Data.Common.DbConnection -> Microsoft.EntityFrameworkCore.Infrastructure.RelationalOptionsExtension
Public Overridable Function WithConnection (connection As DbConnection) As RelationalOptionsExtension

Parameters

connection
DbConnection

The option to change.

Returns

A new instance with the option changed.

Applies to

WithConnection(DbConnection, Boolean)

Creates a new instance with all options the same as for this instance, but with the given option changed. It is unusual to call this method directly. Instead use DbContextOptionsBuilder.

public virtual Microsoft.EntityFrameworkCore.Infrastructure.RelationalOptionsExtension WithConnection (System.Data.Common.DbConnection? connection, bool owned);
abstract member WithConnection : System.Data.Common.DbConnection * bool -> Microsoft.EntityFrameworkCore.Infrastructure.RelationalOptionsExtension
override this.WithConnection : System.Data.Common.DbConnection * bool -> Microsoft.EntityFrameworkCore.Infrastructure.RelationalOptionsExtension
Public Overridable Function WithConnection (connection As DbConnection, owned As Boolean) As RelationalOptionsExtension

Parameters

connection
DbConnection

The option to change.

owned
Boolean

If true, then the connection will become owned by the context, and will be disposed in the same way that a connection created by the context is disposed.

Returns

A new instance with the option changed.

Applies to