Pular para o conteúdo principal
Versão: 10.4.1

ITLab.Template.DevPack.Infrastructure.EfCore.Interceptors

Implements EF Core SaveChanges interceptors for cross-cutting persistence behaviors.

Componentes

TipoNomeResponsabilidade
ClassAuditableEntityInterceptorApplies created/updated metadata for IAuditable entities before each save
ClassSoftDeleteInterceptorConverts hard deletes to soft-delete updates for ISoftDeletable entities
ClassDispatchDomainEventsInterceptorPublishes and clears domain events from tracked entities after save

Como usar

// Interceptors are additive and can be chained.
options.AddInterceptors(
auditableInterceptor,
softDeleteInterceptor,
dispatchDomainEventsInterceptor);

O que não fazer

  • Do not depend on interceptor side effects for business invariants.
  • Do not publish integration events directly in DispatchDomainEventsInterceptor without outbox guarantees.

Extensão pelo produto

  • Products can override behavior by replacing registrations with custom interceptor implementations.
  • If replacing, preserve the contracts of IAuditable and ISoftDeletable to keep consistency.