Class ApplicationSaveChangesInterceptor
- Namespace
- ReferenceApplication.Infrastructure.Data
- Assembly
- ReferenceApplication.Infrastructure.dll
Invokes the application save pipeline from the EF Core SaveChanges interception lifecycle.
public sealed class ApplicationSaveChangesInterceptor : SaveChangesInterceptor, ISaveChangesInterceptor, IInterceptor
- Inheritance
-
ApplicationSaveChangesInterceptor
- Implements
- Inherited Members
Constructors
ApplicationSaveChangesInterceptor(IApplicationSaveChangesPipeline)
Initializes a new instance of the ApplicationSaveChangesInterceptor class.
public ApplicationSaveChangesInterceptor(IApplicationSaveChangesPipeline saveChangesPipeline)
Parameters
saveChangesPipelineIApplicationSaveChangesPipelineThe application-owned save pipeline.
Methods
SavedChanges(SaveChangesCompletedEventData, int)
Runs ApplyAfterSaveChanges(ApplicationDbContext) after EF Core persists the tracked changes of an ApplicationDbContext, and saves again when the pipeline appended audit records that depend on database-generated values.
public override int SavedChanges(SaveChangesCompletedEventData eventData, int result)
Parameters
eventDataSaveChangesCompletedEventDataContextual information about the completed save operation.
resultintThe number of state entries written by the original save.
Returns
- int
The
resultsupplied by EF Core.
SavedChangesAsync(SaveChangesCompletedEventData, int, CancellationToken)
Runs ApplyAfterSaveChangesAsync(ApplicationDbContext, CancellationToken) after EF Core asynchronously persists the tracked changes of an ApplicationDbContext, and saves again when the pipeline appended audit records that depend on database-generated values.
public override ValueTask<int> SavedChangesAsync(SaveChangesCompletedEventData eventData, int result, CancellationToken cancellationToken = default)
Parameters
eventDataSaveChangesCompletedEventDataContextual information about the completed save operation.
resultintThe number of state entries written by the original save.
cancellationTokenCancellationTokenA token that can cancel the operation.
Returns
SavingChanges(DbContextEventData, InterceptionResult<int>)
Runs ApplyBeforeSaveChanges(ApplicationDbContext) before EF Core persists the tracked changes of an ApplicationDbContext. Other contexts pass through unchanged.
public override InterceptionResult<int> SavingChanges(DbContextEventData eventData, InterceptionResult<int> result)
Parameters
eventDataDbContextEventDataContextual information about the save operation.
resultInterceptionResult<int>The current interception result, returned unchanged.
Returns
- InterceptionResult<int>
The
resultsupplied by EF Core.
SavingChangesAsync(DbContextEventData, InterceptionResult<int>, CancellationToken)
Runs ApplyBeforeSaveChangesAsync(ApplicationDbContext, CancellationToken) before EF Core asynchronously persists the tracked changes of an ApplicationDbContext. Other contexts pass through unchanged.
public override ValueTask<InterceptionResult<int>> SavingChangesAsync(DbContextEventData eventData, InterceptionResult<int> result, CancellationToken cancellationToken = default)
Parameters
eventDataDbContextEventDataContextual information about the save operation.
resultInterceptionResult<int>The current interception result, returned unchanged.
cancellationTokenCancellationTokenA token that can cancel the operation.
Returns
- ValueTask<InterceptionResult<int>>
The
resultsupplied by EF Core.