-
Notifications
You must be signed in to change notification settings - Fork 53
Added overloads for simplified func-based activity and orchestrator registration #589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
halspang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
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