Skip to content

Accept "ev" as a conventional event parameter name (#4562)#369

Merged
jeremydmiller merged 1 commit into
mainfrom
fix/4562-accept-ev-event-name
May 26, 2026
Merged

Accept "ev" as a conventional event parameter name (#4562)#369
jeremydmiller merged 1 commit into
mainfrom
fix/4562-accept-ev-event-name

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Follow-up to the event-source-generator naming work for JasperFx/marten#4562.

What

CodeGenerationExtensions.GetEventType is the single shared rule that all projection types (SingleStreamProjection, MultiStreamProjection, and EventProjection) use to decide which parameter of a conventional method is the event. When the event can't be inferred by type alone (more than one candidate parameter), it falls back to the conventional event parameter name.

This adds "ev" to the accepted names, alongside the existing @event, event, and eev is a common shorthand and there's no reason to reject it.

// all four now resolve the event parameter when type inference is ambiguous:
public void Apply(SomeEvent @event, MyAggregate agg) { }
public void Apply(SomeEvent ev, MyAggregate agg) { }
public void Apply(SomeEvent e, MyAggregate agg) { }

Notes

  • For the overwhelmingly common case (a single concrete event parameter, with session/operations as interfaces), the event is still inferred by type — no special parameter name is required. The name convention only matters as a disambiguator.
  • Added a focused unit test covering @event, e, and ev disambiguation.
  • The naming convention itself is being documented clearly in companion docs PRs for Marten (including the 9.0 migration guide) and Polecat.

🤖 Generated with Claude Code

When a conventional projection method's event argument can't be inferred by
type alone (more than one candidate parameter), GetEventType falls back to the
conventional event parameter name. Add "ev" to the accepted names alongside the
existing "@event", "event", and "e", since "ev" is a common shorthand.

This is the single shared rule used by SingleStreamProjection, MultiStreamProjection,
and EventProjection method discovery, so the convention is consistent across all
projection types.

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