IDbTransactionInterceptor.TransactionStartedAsync Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Chamado imediatamente após o EF chamar 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)
Parâmetros
- connection
- DbConnection
A conexão.
- eventData
- TransactionEndEventData
Informações contextuais sobre conexão e transação.
- result
- DbTransaction
O resultado da chamada para BeginTransactionAsync(IsolationLevel, CancellationToken). Esse valor normalmente é usado como o valor retornado para a implementação desse método.
- cancellationToken
- CancellationToken
Um CancellationToken a ser observado enquanto aguarda a conclusão da tarefa.
Retornos
Um Task que fornece o resultado que o EF usará.
Uma implementação desse método para qualquer interceptador que não esteja tentando alterar o resultado é retornar o result
valor passado, muitas vezes usando FromResult<TResult>(TResult)
Exceções
Se o padrão CancellationToken for cancelado.
Comentários
Esse método ainda será chamado se um interceptador suprimiu a criação em TransactionStarting(DbConnection, TransactionStartingEventData, InterceptionResult<DbTransaction>). Nesse caso, result
é o resultado retornado por TransactionStarting(DbConnection, TransactionStartingEventData, InterceptionResult<DbTransaction>).
Aplica-se a
Entity Framework