Added overloads for simplified func-based activity and orchestrator registration#589
Open
Added overloads for simplified func-based activity and orchestrator registration#589
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds simplified overloads for func-based activity and orchestrator registration, allowing developers to omit the explicit name parameter. The name is automatically inferred from either a [DurableTask] attribute on the method or the method name itself, reducing boilerplate when registering tasks.
Key changes:
- Added 8 new overloads each for
AddOrchestratorFuncandAddActivityFuncthat infer task names from delegates - Extended
DurableTaskAttributeto support method-level application for custom naming - Comprehensive test coverage for all new overload variations including lambda detection
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/Abstractions/DurableTaskRegistry.Orchestrators.cs |
Added 8 new AddOrchestratorFunc overloads with name inference and GetTaskNameFromDelegate helper method |
src/Abstractions/DurableTaskRegistry.Activities.cs |
Added 8 new AddActivityFunc overloads with name inference and GetActivityNameFromDelegate helper method |
src/Abstractions/DurableTaskAttribute.cs |
Extended AttributeUsage to support methods and updated documentation to reflect method usage |
test/Worker/Core.Tests/DurableTaskRegistryTests.Orchestrators.cs |
Added 10 new test cases covering all orchestrator overload variations and error conditions |
test/Worker/Core.Tests/DurableTaskRegistryTests.Activities.cs |
Added 10 new test cases covering all activity overload variations and error conditions |
src/Abstractions/Entities/TaskEntity.cs |
Added string type validation for entity state (unrelated to PR purpose) |
misc/misc.csproj |
Added Directory.Packages.* to project includes (unrelated to PR purpose) |
halspang
reviewed
Jan 21, 2026
Member
halspang
left a comment
There was a problem hiding this comment.
Mostly nits, but I am concerned about a potential breaking change. If you could assuage my fear there, I think we're basically good to go.
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.
Summary
What changed?
Added new overloads for func-based activity and orchestrator registration.
For example, instead of doing this all the time:
I can now do this:
Why is this change needed?
The current methods are verbose and require writing repetitive code. I found it quite annoying when creating samples.
Issues / work items
There are no work items associated with this PR
Project checklist
release_notes.mdAI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
AI verification (required if AI was used):
Testing
Automated tests
Manual validation (only if runtime/behavior changed)
N/A
Notes for reviewers