Share via


Database.UseTransaction(DbTransaction) Method

Definition

Enables the user to pass in a database transaction created outside of the Database object if you want the Entity Framework to execute commands within that external transaction. Alternatively, pass in null to clear the framework's knowledge of that transaction.

public void UseTransaction (System.Data.Common.DbTransaction transaction);
member this.UseTransaction : System.Data.Common.DbTransaction -> unit
Public Sub UseTransaction (transaction As DbTransaction)

Parameters

transaction
DbTransaction

the external transaction

Exceptions

Thrown if the connection associated with the transaction does not match the Entity Framework's connection

Applies to