Skip to content

Add EnrichEventsAsync hook to EventProjection#176

Merged
jeremydmiller merged 1 commit intomainfrom
feature/event-projection-enrichment
Apr 6, 2026
Merged

Add EnrichEventsAsync hook to EventProjection#176
jeremydmiller merged 1 commit intomainfrom
feature/event-projection-enrichment

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Summary

  • New EnrichEventsAsync(TQuerySession, IReadOnlyList<IEvent>, CancellationToken) virtual method on JasperFxEventProjectionBase
  • Called before individual event processing for both inline and async lifecycles
  • Enables batch-loading reference data to avoid N+1 queries in EventProjection
  • New IEventEnrichment<TQuerySession> interface for type-safe pipeline detection
  • Matches the enrichment pattern already available on aggregation projections (SingleStreamProjection, MultiStreamProjection)

Closes JasperFx/marten#4143

Test plan

  • 3 Marten tests verifying enrichment works inline (simple, DB lookup, call order)

🤖 Generated with Claude Code

New virtual method on JasperFxEventProjectionBase:
  Task EnrichEventsAsync(TQuerySession, IReadOnlyList<IEvent>, CancellationToken)

Called before individual event processing for both inline and async
lifecycles. Enables batch-loading reference data to avoid N+1 queries,
matching the pattern already available on aggregation projections.

New IEventEnrichment<TQuerySession> interface for type-safe detection
in the projection execution pipeline.

Closes JasperFx/marten#4143

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jeremydmiller added a commit to JasperFx/marten that referenced this pull request Apr 6, 2026
- 3 integration tests verifying enrichment works with inline EventProjection
- Documentation added to event-projections.md with usage example
- Temporary ProjectReference to local JasperFx.Events for development
  (revert to PackageReference before merging)

Depends on JasperFx/jasperfx#176

Closes #4143

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jeremydmiller added a commit to JasperFx/polecat that referenced this pull request Apr 6, 2026
3 tests verifying event enrichment works with Polecat's EventProjection:
- Simple enrichment (hardcoded property set before Apply)
- Call order verification (enrichment before apply)
- Database lookup enrichment (batch-load reference data)

Depends on JasperFx/jasperfx#176 (EnrichEventsAsync on JasperFxEventProjectionBase)
Temporary ProjectReference to local JasperFx.Events for development.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jeremydmiller jeremydmiller merged commit aa9e954 into main Apr 6, 2026
1 check passed
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.

Add an event enrichment hook to EventProjection

1 participant