RelationalConnection.SetDbConnection(DbConnection, Boolean) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the underlying DbConnection used to connect to the database.
public virtual void SetDbConnection (System.Data.Common.DbConnection? value, bool contextOwnsConnection);
abstract member SetDbConnection : System.Data.Common.DbConnection * bool -> unit
override this.SetDbConnection : System.Data.Common.DbConnection * bool -> unit
Public Overridable Sub SetDbConnection (value As DbConnection, contextOwnsConnection As Boolean)
Parameters
- value
- DbConnection
The connection object.
- contextOwnsConnection
- Boolean
If true
, then EF will take ownership of the connection and will
dispose it in the same way it would dispose a connection created by EF. If false
, then the caller still
owns the connection and is responsible for its disposal.
Implements
Applies to
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Entity Framework