Skip to content

feat(abstractions): deprecate [Event] attribute in favor of [FromEvent] #249

Description

@j-d-ha

Summary

Deprecate the [Event] attribute in favor of a new [FromEvent] attribute to align with ASP.NET Core conventions like [FromBody], [FromQuery], [FromRoute], etc.

Motivation

  • Convention alignment: ASP.NET Core uses [From*] naming pattern for parameter binding attributes
  • Clarity: The [From*] pattern makes it explicit where the parameter value comes from
  • Consistency: Developers familiar with ASP.NET Core will recognize the pattern immediately

Tasks

  • Create new [FromEvent] attribute with same functionality as [Event]
  • Mark [Event] attribute as [Obsolete] with appropriate warning message
  • Update documentation to recommend [FromEvent]
  • Add migration guide in documentation
  • Update all examples and samples to use [FromEvent]
  • Add tests for [FromEvent] attribute
  • Plan deprecation timeline (consider removing in next major version)

Migration Example

// Old (deprecated)
public class MyHandler
{
    public string Handle([Event] MyEvent evt) => evt.Message;
}

// New (recommended)
public class MyHandler
{
    public string Handle([FromEvent] MyEvent evt) => evt.Message;
}

Breaking Change Considerations

This change should be introduced as non-breaking:

  • Keep [Event] working alongside [FromEvent]
  • Mark as obsolete with compiler warning
  • Remove in next major version (v2.0.0 or later)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions