Skip to content

fix(audit): Ignore audit trail attribute#1224

Open
cesarcastrocuba wants to merge 1 commit intofullstackhero:developfrom
cesarcastrocuba:fix/ignore-audit-trail-attribute
Open

fix(audit): Ignore audit trail attribute#1224
cesarcastrocuba wants to merge 1 commit intofullstackhero:developfrom
cesarcastrocuba:fix/ignore-audit-trail-attribute

Conversation

@cesarcastrocuba
Copy link

[Fix] Implement IgnoreAuditTrail Attribute for Infrastructure Entities

Description

This Pull Request implements the [IgnoreAuditTrail] attribute to optimize the auditing system. It allows specific high-frequency or technical entities to be excluded from the audit logs, reducing database noise and improving general performance.

Changes

  • BuildingBlocks.Core: Created IgnoreAuditTrailAttribute to serve as an opt-out decorator.
  • Modules.Auditing: Updated AuditingSaveChangesInterceptor to filter and skip any entity decorated with [IgnoreAuditTrail] before publishing audit events.
  • Infrastructure Entities: Applied the attribute to:
    • OutboxMessage (Eventing)
    • InboxMessage (Eventing)
    • UserSession (Identity)

Verification

  • Build: Successfully ran dotnet build src/FSH.Framework.slnx with 0 errors.
  • Logic: Verified through temporary InMemoryDatabase unit tests (which were deleted after confirmation) that:
    • Tagged entities are correctly ignored by the interceptor.
    • Non-tagged entities continue to be audited as expected.

Technical Debt

  • Issue Bump Dapper from 2.0.78 to 2.0.90 #15 Dependency: Once the central AuditableEntitySaveChangesInterceptor is merged into develop, it should also be updated to check for this attribute to prevent populating metadata fields (CreatedOn/By, etc.) on ignored entities.

…entities

- Created [IgnoreAuditTrail] attribute in BuildingBlocks.Core.
- Updated AuditingSaveChangesInterceptor to exclude entities decorated with the attribute.
- Applied [IgnoreAuditTrail] to OutboxMessage, InboxMessage, and UserSession.
- Verified changes with temporary InMemoryDatabase unit tests (cleaned up before commit).
- Optimized audit performance by reducing noise from high-frequency infrastructure entities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant