ISaveChangesInterceptor.SavingChangesAsync Método

Definición

Se llama al principio 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

Información contextual sobre el DbContext objeto que se usa.

result
InterceptionResult<Int32>

Representa el resultado actual si existe uno. Este valor se establecerá HasResulttrue en si algún interceptor anterior suprimió la ejecución mediante una llamada a SuppressWithResult(TResult). Este valor se usa normalmente como valor devuelto para la implementación de este método.

cancellationToken
CancellationToken

Que CancellationToken se debe observar mientras se espera a que se complete la tarea.

Devoluciones

Si HasResult es false, EF continuará como es normal. Si HasResult es true, EF suprimirá la operación que estaba a punto de realizar y usar Result en su lugar. Una implementación de este método para cualquier interceptor que no intente cambiar el resultado es devolver el result valor pasado.

Excepciones

Se aplica a