using Femto.Modules.Auth.Data; using MediatR; namespace Femto.Modules.Auth.Infrastructure; internal class SaveChangesPipelineBehaviour(AuthContext context) : IPipelineBehavior where TRequest : notnull { public async Task Handle( TRequest request, RequestHandlerDelegate next, CancellationToken cancellationToken ) { var response = await next(cancellationToken); if (context.ChangeTracker.HasChanges()) await context.SaveChangesAsync(cancellationToken); return response; } }