Convention-based handlers#8224
Draft
DavidBoike wants to merge 4 commits intocore-10.2from
Draft
Conversation
| } | ||
| } | ||
|
|
||
| [HandlerRegistryExtensions(EntryPointName = "SampleProject")] |
Contributor
There was a problem hiding this comment.
I'm so glad we added this 😍
| - The hadnler method's second parameter must be an `IMessageHandlerContext`. | ||
| - After the first two parameters, any additional parameters must be either a `CancellationToken` or registered in host's `IServiceCollection`. | ||
| - The method can be an instance or static method. | ||
| - A handler class may contain multiple handler methods, differing by the message type, but these methods become an inseparable unit. It is not possible to register one handler method on a class but not the other. |
Contributor
There was a problem hiding this comment.
Would inline code demonstrating the convention be helpful to make the text more memorable?
Member
Author
There was a problem hiding this comment.
Did the new TLDR content at the top address this? If not, I'm not sure exactly what you mean.
Co-authored-by: Daniel Marbach <daniel.marbach@openplace.net> Co-authored-by: Andreas Öhlund <andreas.ohlund@particular.net>
6db75e5 to
02cbba4
Compare
02cbba4 to
fa0a35f
Compare
DavidBoike
commented
Apr 30, 2026
| - After the first two parameters, any additional parameters must be either a `CancellationToken` or Services registered in the host's `IServiceCollection`. | ||
| - It can be an instance or static method. | ||
| - A handler class may contain multiple handler methods, differing by the message type, but these methods become an inseparable unit. It is not possible to register one handler method on a class but not the other. | ||
| - If multiple handler methods use the same message type as the first parameter, they will all be executed on the same message. |
Member
Author
There was a problem hiding this comment.
So is that accurate then?
| - The hadnler method's second parameter must be an `IMessageHandlerContext`. | ||
| - After the first two parameters, any additional parameters must be either a `CancellationToken` or registered in host's `IServiceCollection`. | ||
| - The method can be an instance or static method. | ||
| - A handler class may contain multiple handler methods, differing by the message type, but these methods become an inseparable unit. It is not possible to register one handler method on a class but not the other. |
Member
Author
There was a problem hiding this comment.
Did the new TLDR content at the top address this? If not, I'm not sure exactly what you mean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Will need to be rebased on top of a general 10.2 branch.