IDbTransactionInterceptor.TransactionStartedAsync 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.
Called immediately after EF calls BeginTransactionAsync(IsolationLevel, CancellationToken).
public System.Threading.Tasks.Task<System.Data.Common.DbTransaction> TransactionStartedAsync (System.Data.Common.DbConnection connection, Microsoft.EntityFrameworkCore.Diagnostics.TransactionEndEventData eventData, System.Data.Common.DbTransaction result, System.Threading.CancellationToken cancellationToken = default);
public System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction> TransactionStartedAsync (System.Data.Common.DbConnection connection, Microsoft.EntityFrameworkCore.Diagnostics.TransactionEndEventData eventData, System.Data.Common.DbTransaction result, System.Threading.CancellationToken cancellationToken = default);
public virtual System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction> TransactionStartedAsync (System.Data.Common.DbConnection connection, Microsoft.EntityFrameworkCore.Diagnostics.TransactionEndEventData eventData, System.Data.Common.DbTransaction result, System.Threading.CancellationToken cancellationToken = default);
abstract member TransactionStartedAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionEndEventData * System.Data.Common.DbTransaction * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Data.Common.DbTransaction>
abstract member TransactionStartedAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionEndEventData * System.Data.Common.DbTransaction * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction>
abstract member TransactionStartedAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionEndEventData * System.Data.Common.DbTransaction * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction>
override this.TransactionStartedAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionEndEventData * System.Data.Common.DbTransaction * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction>
Public Function TransactionStartedAsync (connection As DbConnection, eventData As TransactionEndEventData, result As DbTransaction, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DbTransaction)
Public Function TransactionStartedAsync (connection As DbConnection, eventData As TransactionEndEventData, result As DbTransaction, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of DbTransaction)
Public Overridable Function TransactionStartedAsync (connection As DbConnection, eventData As TransactionEndEventData, result As DbTransaction, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of DbTransaction)
Parameters
- connection
- DbConnection
The connection.
- eventData
- TransactionEndEventData
Contextual information about connection and transaction.
- result
- DbTransaction
The result of the call to BeginTransactionAsync(IsolationLevel, CancellationToken). This value is typically used as the return value for the implementation of this method.
- cancellationToken
- CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Returns
A Task providing the result that EF will use.
An 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)
Exceptions
If the CancellationToken is canceled.
Remarks
This method is still called if an interceptor suppressed creation in TransactionStarting(DbConnection, TransactionStartingEventData, InterceptionResult<DbTransaction>). In this case, result
is the result returned by TransactionStarting(DbConnection, TransactionStartingEventData, InterceptionResult<DbTransaction>).
Applies to
Entity Framework