Skip to content

docs: clarify how the event argument is identified in conventional methods (#4562)#4563

Merged
jeremydmiller merged 2 commits into
masterfrom
docs/4562-event-parameter-naming
May 26, 2026
Merged

docs: clarify how the event argument is identified in conventional methods (#4562)#4563
jeremydmiller merged 2 commits into
masterfrom
docs/4562-event-parameter-naming

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Documentation-only. Closes the docs half of #4562.

Why

The conventional projection method docs explain which argument combinations are allowed, but never state how Marten decides which parameter is the event — which leads people to think they must name the parameter @event. They don't: the event is identified by type, and a parameter name only matters to disambiguate unusual signatures.

What

Documents the single, shared rule used by SingleStreamProjection, MultiStreamProjection, and EventProjection:

  1. an IEvent<T> parameter is the event (T is the event type);
  2. otherwise the single concrete parameter that isn't an interface (IQuerySession/IDocumentOperations), isn't IEvent, isn't CancellationToken, and isn't the aggregate type;
  3. only if that's ambiguous, a parameter named @event, event, e, or ev.

Changes:

  • events/projections/conventions.md — new "How Marten Identifies the Event Argument" section near the top.
  • events/projections/event-projections.md — "Identifying the Event Parameter" note for Create()/Project(), linking to the shared rule.
  • migration-guide.md — new subsection under the projection-conventions migration, since this trips people up when moving off inline lambdas.

Related

🤖 Generated with Claude Code

…thods (#4562)

The conventional projection method docs explained which argument *combinations*
are allowed, but never stated how Marten decides which parameter is the event.
Document the shared, type-based rule used by SingleStreamProjection,
MultiStreamProjection, and EventProjection, and the conventional event parameter
names (@event / event / e / ev) that only matter for disambiguating signatures
type inference can't resolve.

- conventions.md: new "How Marten Identifies the Event Argument" section
- event-projections.md: "Identifying the Event Parameter" note linking to it
- migration-guide.md: new subsection under the projection-conventions migration

Docs-only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The "linting, spell check and build" check failed on two dash-style list items
(docs/migration-guide.md:377-378). The repo's markdownlint config enforces
asterisk unordered-list bullets (MD004/ul-style); switch the two bullets to `*`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jeremydmiller jeremydmiller merged commit 19ca9f7 into master May 26, 2026
1 check passed
@jeremydmiller jeremydmiller deleted the docs/4562-event-parameter-naming branch May 26, 2026 20:56
jeremydmiller added a commit that referenced this pull request May 27, 2026
Bump the four JasperFx packages Marten depends on to the aligned 2.1.2 release
(they now lock to a single $(JasperFxVersion) upstream):

- JasperFx                          2.0.1 -> 2.1.2
- JasperFx.Events                   2.1.1 -> 2.1.2
- JasperFx.Events.SourceGenerator   2.1.1 -> 2.1.2
- JasperFx.SourceGenerator          2.0.1 -> 2.1.2

JasperFx.RuntimeCompiler is intentionally left alone — it versions independently
upstream and is not part of the 2.1.2 set (and master no longer references it).

2.1.2 carries the #4562 event-parameter-naming generator support (accepts `ev`
as a conventional event parameter name) whose docs landed in #4563. Full solution
builds clean against 2.1.2 (0 errors, all 45 projects); no API adaptation needed.

Co-authored-by: Claude Opus 4.7 (1M context) <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