Compartilhar via


ISaveChangesInterceptor.SavingChangesAsync Método

Definição

Chamado no início de DbContext.SaveChangesAsync.

public System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>> SavingChangesAsync (Microsoft.EntityFrameworkCore.Diagnostics.DbContextEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> result, System.Threading.CancellationToken cancellationToken = default);
public virtual System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>> SavingChangesAsync (Microsoft.EntityFrameworkCore.Diagnostics.DbContextEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> result, System.Threading.CancellationToken cancellationToken = default);
abstract member SavingChangesAsync : Microsoft.EntityFrameworkCore.Diagnostics.DbContextEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>>
abstract member SavingChangesAsync : Microsoft.EntityFrameworkCore.Diagnostics.DbContextEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>>
override this.SavingChangesAsync : Microsoft.EntityFrameworkCore.Diagnostics.DbContextEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>>
Public Function SavingChangesAsync (eventData As DbContextEventData, result As InterceptionResult(Of Integer), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of InterceptionResult(Of Integer))
Public Overridable Function SavingChangesAsync (eventData As DbContextEventData, result As InterceptionResult(Of Integer), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of InterceptionResult(Of Integer))

Parâmetros

eventData
DbContextEventData

Informações contextuais sobre o DbContext que está sendo usado.

result
InterceptionResult<Int32>

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 desse método para qualquer interceptador que não está tentando alterar o resultado é retornar o result valor passado.

Exceções

Se o padrão CancellationToken for cancelado.

Aplica-se a