Skip to content

Allow multiple HandlerOrder attributes on a single handler class - #4

Merged
Skymly merged 2 commits into
mainfrom
feature/sourcegenerators/handler-allow-multiple
Jun 4, 2026
Merged

Allow multiple HandlerOrder attributes on a single handler class#4
Skymly merged 2 commits into
mainfrom
feature/sourcegenerators/handler-allow-multiple

Conversation

@Skymly

@Skymly Skymly commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Enables AllowMultiple on HandlerOrderAttribute / HandlerOrderAttribute<TContext>.
  • HandlerOrderGenerator collects every attribute instance (aligned with RegisterStrategyGenerator) and still groups pipelines by context type.
  • Adds generator Verify + integration coverage for one handler class in two pipelines.

Closes #3

Test plan

  • dotnet test DesignPatterns.slnx -c Release (173 tests)
  • CI green on PR

Note

Low Risk
Additive generator and attribute usage change with existing DP005 validation and new tests; no auth or data-path changes.

Overview
Enables multiple [HandlerOrder] / [HandlerOrder<TContext>] attributes on one handler class, so a single type can join separate generated pipelines for different context types (e.g. shared logging for RequestContext and AuditContext).

HandlerOrderGenerator now emits one registration per attribute instance (not only the first) and flattens collected outputs before building per-context pipelines. Duplicate order for the same context still raises DP005, including when two attributes on the same class target the same context.

Docs and roadmap note the feature; generator Verify snapshots and an integration test cover multi-context pipelines and same-class duplicate order. .gitignore adds .nuke/temp/.

Reviewed by Cursor Bugbot for commit b2e52fb. Configure here.

Skymly added 2 commits June 4, 2026 19:34
1、Set AllowMultiple on HandlerOrder attributes and collect every attribute in the generator

2、Add generator Verify and integration tests for multi-context handlers

3、Document in ChainOfResponsibility.md and mark ROADMAP item complete
@Skymly
Skymly merged commit 46f10d4 into main Jun 4, 2026
3 checks passed
@Skymly
Skymly deleted the feature/sourcegenerators/handler-allow-multiple branch June 4, 2026 12:01
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.

Allow multiple HandlerOrder attributes on a single handler class

1 participant