ISaveChangesInterceptor.SavingChangesAsync Method

Definition

Called at the start of 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))

Parameters

eventData
DbContextEventData

Contextual information about the DbContext being used.

result
InterceptionResult<Int32>

Represents the current result if one exists. This value will have HasResult set to true if some previous interceptor suppressed execution by calling SuppressWithResult(TResult). This value is typically used as the return value for the implementation of this method.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

If HasResult is false, the EF will continue as normal. If HasResult is true, then EF will suppress the operation it was about to perform and use Result instead. An implementation of this method for any interceptor that is not attempting to change the result is to return the result value passed in.

Exceptions

Applies to