Skip to content

Add DCB event type filtering and auto-discovery of tag types#4170

Merged
jeremydmiller merged 2 commits intomasterfrom
auto-discovery-of-tags
Mar 12, 2026
Merged

Add DCB event type filtering and auto-discovery of tag types#4170
jeremydmiller merged 2 commits intomasterfrom
auto-discovery-of-tags

Conversation

@jeremydmiller
Copy link
Member

@jeremydmiller jeremydmiller commented Mar 12, 2026

Summary

  • Event type filtering in FetchForWritingByTags: When the aggregator's projection extends EventFilterable and has IncludedEventTypes, those types are automatically applied as a SQL filter (AND e.type = ANY(...)) on tag queries. This eliminates the need to redundantly specify event types in both the projection and the EventTagQuery.

  • Auto-discovery of tag types from projections: During EventGraph.Initialize(), registered SingleStreamProjection and MultiStreamProjection types with strong-typed identifiers (non-primitive TId) are automatically registered as tag types with ForAggregate(). Users no longer need to explicitly call RegisterTagType<T>().ForAggregate<TAgg>() unless they want to customize the table suffix.

  • Unit tests: 5 new tests covering auto-discovery behavior (auto-registration, explicit precedence, primitive type exclusion, querying, and fetch-for-writing integration).

  • Documentation: Updated docs/events/dcb.md with a new "Automatic Tag Type Registration" section explaining how projections with strong-typed identifiers auto-register tag types.

Test plan

  • All 42 DCB tests pass (37 existing + 5 new)
  • All 1125 EventSourcingTests pass (2 skipped)
  • CI matrix build across .NET 8/10, PostgreSQL 15/latest, both serializers

🤖 Generated with Claude Code

jeremydmiller and others added 2 commits March 12, 2026 07:21
…types

- FetchForWritingByTags now automatically applies event type filtering from
  the aggregator's projection when it extends EventFilterable, so users don't
  have to redundantly specify event types in both the projection and the
  EventTagQuery.

- Tag types are now auto-discovered from registered SingleStreamProjection
  and MultiStreamProjection types that use strong-typed identifiers as their
  TId. Users no longer need to explicitly call RegisterTagType().ForAggregate()
  unless they want to customize the table suffix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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