Share via


DbTransactionInterceptor.TransactionStarting Method

Definition

Called just before EF intends to call BeginTransaction(IsolationLevel).

public virtual Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> TransactionStarting (System.Data.Common.DbConnection connection, Microsoft.EntityFrameworkCore.Diagnostics.TransactionStartingEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> result);
abstract member TransactionStarting : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionStartingEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction>
override this.TransactionStarting : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionStartingEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction>
Public Overridable Function TransactionStarting (connection As DbConnection, eventData As TransactionStartingEventData, result As InterceptionResult(Of DbTransaction)) As InterceptionResult(Of DbTransaction)

Parameters

connection
DbConnection

The connection.

eventData
TransactionStartingEventData

Contextual information about connection and transaction.

result
InterceptionResult<DbTransaction>

Represents the current result if one exists. This value will have HasResult set to true if some previous interceptor suppressed execution by calling SuppressWithResult(TResult). This value is typically used as the return value for the implementation of this method.

Returns

If HasResult is false, the EF will continue as normal. If HasResult is true, then EF will suppress the operation it was about to perform and use Result instead. A normal implementation of this method for any interceptor that is not attempting to change the result is to return the result value passed in, often using FromResult<TResult>(TResult)

Implements

Applies to