Share via


ISaveChangesInterceptor.SavedChangesAsync Method

Definition

Called at the end of DbContext.SaveChangesAsync.

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

Parameters

eventData
SaveChangesCompletedEventData

Contextual information about the DbContext being used.

result
Int32

The result of the call to DbContext.SaveChangesAsync. 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

The result that EF will use. 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

Remarks

This method is still called if an interceptor suppressed creation of a command in SavingChangesAsync(DbContextEventData, InterceptionResult<Int32>, CancellationToken). In this case, result is the result returned by SavingChangesAsync(DbContextEventData, InterceptionResult<Int32>, CancellationToken).

Applies to