Lingua

ISaveChangesInterceptor Interfaccia

Definizione

Consente l'intercettazione DbContext.SaveChanges dei metodi e DbContext.SaveChangesAync .

public interface ISaveChangesInterceptor : Microsoft.EntityFrameworkCore.Diagnostics.IInterceptor
type ISaveChangesInterceptor = interface
    interface IInterceptor
Public Interface ISaveChangesInterceptor
Implements IInterceptor
Derivato
Implementazioni

Commenti

Gli intercettori SaveChanges possono essere usati per visualizzare, modificare o eliminare l'esecuzione della chiamata SaveChanges e modificare il risultato prima che venga restituito a Entity Framework.

Se non si implementano tutti i metodi, è consigliabile ereditare da SaveChangesInterceptor .

Usare AddInterceptors(IInterceptor[]) per registrare gli intercettori di applicazioni.

Le estensioni possono anche registrare intercettori nel provider di servizi interno. Se vengono rilevati intercettori inseriti e dell'applicazione, gli intercettori inseriti vengono eseguiti nell'ordine in cui vengono risolti dal provider di servizi e quindi gli intercettori dell'applicazione vengono eseguiti per ultimo.

Per altre informazioni ed esempi, vedere Intercettori di EF Core .

Metodi

Nome Descrizione
SaveChangesCanceled(DbContextEventData)

Chiamato quando DbContext.SaveChanges è stato annullato.

SaveChangesCanceledAsync(DbContextEventData, CancellationToken)

Chiamato quando DbContext.SaveChangesAsync è stato annullato.

SaveChangesFailed(DbContextErrorEventData)

Chiamato quando è stata generata un'eccezione in DbContext.SaveChanges.

SaveChangesFailedAsync(DbContextErrorEventData, CancellationToken)

Chiamato quando è stata generata un'eccezione in DbContext.SaveChangesAsync.

SavedChanges(SaveChangesCompletedEventData, Int32)

Chiamato alla fine di DbContext.SaveChanges.

SavedChangesAsync(SaveChangesCompletedEventData, Int32, CancellationToken)

Chiamato alla fine di DbContext.SaveChangesAsync.

SavingChanges(DbContextEventData, InterceptionResult<Int32>)

Chiamato all'inizio di DbContext.SaveChanges.

SavingChangesAsync(DbContextEventData, InterceptionResult<Int32>, CancellationToken)

Chiamato all'inizio di DbContext.SaveChangesAsync.

ThrowingConcurrencyException(ConcurrencyExceptionEventData, InterceptionResult)

Chiamato immediatamente prima che ENTITY generi un'eccezione DbUpdateConcurrencyException.

ThrowingConcurrencyExceptionAsync(ConcurrencyExceptionEventData, InterceptionResult, CancellationToken)

Chiamato immediatamente prima che ENTITY generi un'eccezione DbUpdateConcurrencyException.

Si applica a