Jazyk

ISaveChangesInterceptor.SavingChangesAsync Metoda

Definice

Volá se na začátku .DbContext.SaveChangesAsync

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);
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);
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>>
abstract member SavingChangesAsync : Microsoft.EntityFrameworkCore.Diagnostics.DbContextEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>>
Public Overridable Function SavingChangesAsync (eventData As DbContextEventData, result As InterceptionResult(Of Integer), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of InterceptionResult(Of Integer))
Public Function SavingChangesAsync (eventData As DbContextEventData, result As InterceptionResult(Of Integer), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of InterceptionResult(Of Integer))

Parametry

eventData
DbContextEventData

Kontextové informace o použitém objektu DbContext

result
InterceptionResult<Int32>

Představuje aktuální výsledek, pokud existuje. Tato hodnota bude nastavena HasResult , true pokud některé předchozí zachytávání potlačí provádění voláním SuppressWithResult(TResult). Tato hodnota se obvykle používá jako návratová hodnota pro implementaci této metody.

cancellationToken
CancellationToken

A CancellationToken , která se má sledovat při čekání na dokončení úkolu.

Návraty

Pokud HasResult je hodnota false, ef bude pokračovat v normálním stavu. Pokud HasResult je pravda, ef potlačí operaci, kterou se chystá provést a použít Result . Implementace této metody pro jakýkoli průsečík, který se nepokouší změnit výsledek, je vrátit result hodnotu předanou.

Výjimky

Platí pro