DbTransactionInterceptor.TransactionStartingAsync 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 pouco antes do EF pretende chamar BeginTransactionAsync(IsolationLevel, CancellationToken).
public virtual System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction>> TransactionStartingAsync (System.Data.Common.DbConnection connection, Microsoft.EntityFrameworkCore.Diagnostics.TransactionStartingEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> result, System.Threading.CancellationToken cancellationToken = default);
public virtual System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction>> TransactionStartingAsync (System.Data.Common.DbConnection connection, Microsoft.EntityFrameworkCore.Diagnostics.TransactionStartingEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> result, System.Threading.CancellationToken cancellationToken = default);
abstract member TransactionStartingAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionStartingEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction>>
override this.TransactionStartingAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionStartingEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction>>
abstract member TransactionStartingAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionStartingEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction>>
override this.TransactionStartingAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionStartingEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction>>
Public Overridable Function TransactionStartingAsync (connection As DbConnection, eventData As TransactionStartingEventData, result As InterceptionResult(Of DbTransaction), Optional cancellationToken As CancellationToken = Nothing) As Task(Of InterceptionResult(Of DbTransaction))
Public Overridable Function TransactionStartingAsync (connection As DbConnection, eventData As TransactionStartingEventData, result As InterceptionResult(Of DbTransaction), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of InterceptionResult(Of DbTransaction))
Parâmetros
- connection
- DbConnection
A conexão.
- eventData
- TransactionStartingEventData
Informações contextuais sobre conexão e transação.
- result
- InterceptionResult<DbTransaction>
Representa o resultado atual se houver um.
Esse valor terá HasResult definido como true
se algum interceptador anterior suprimisse a execução chamando SuppressWithResult(TResult).
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
Se HasResult for false, o EF continuará normalmente.
Se HasResult for true, o EF suprimirá a operação que estava prestes a executar e usar Result .
Uma implementação normal desse método para qualquer interceptador que não está tentando alterar o resultado é retornar o result
valor passado, muitas vezes usando FromResult<TResult>(TResult)
Implementações
Exceções
Se o padrão CancellationToken for cancelado.
Aplica-se a
Entity Framework