Skip to content

Conversation

@cgillum
Copy link
Member

@cgillum cgillum commented Dec 22, 2025

Summary

What changed?

Added new overloads for func-based activity and orchestrator registration.

For example, instead of doing this all the time:

static string SendEmail(TaskActivityContext context, string message)
{
    // ...
}

registry.AddActivityFunc<string, string>(nameof(SendEmail), SendEmail);

I can now do this:

[DurableTask(nameof(SendEmail))] // <-- optional
static string SendEmail(TaskActivityContext context, string message)
{
    // ...
}

registry.AddActivityFunc<string, string>(SendEmail);

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 are not required for the next release
    • Otherwise: Notes added to release_notes.md
  • Backport is not required
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • All required tests have been added/updated (unit tests, E2E tests)
  • Breaking change? (no)
    • If yes:
      • Impact:
      • Migration guidance:

AI-assisted code disclosure (required)

Was an AI tool used? (select one)

  • No
  • Yes, AI helped write parts of this PR (e.g., GitHub Copilot)
  • Yes, an AI agent generated most of this PR

If AI was used:

  • Tool(s): GitHub Copilot /w Claude Opus 4.5
  • AI-assisted areas/files: I don't know what this means?
  • What you changed after AI output: Nothing that I can specifically remember

AI verification (required if AI was used):

  • I understand the code and can explain it
  • I verified referenced APIs/types exist and are correct
  • I reviewed edge cases/failure paths (timeouts, retries, cancellation, exceptions)
  • I reviewed concurrency/async behavior
  • I checked for unintended breaking or behavior changes

Testing

Automated tests

  • Result: Passed

Manual validation (only if runtime/behavior changed)

N/A


Notes for reviewers

  • N/A

@cgillum cgillum requested review from halspang and jviau December 22, 2025 22:03
@cgillum cgillum self-assigned this Dec 22, 2025
Copilot AI review requested due to automatic review settings December 22, 2025 22:03
Copy link
Contributor

Copilot AI left a 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 AddOrchestratorFunc and AddActivityFunc that infer task names from delegates
  • Extended DurableTaskAttribute to 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)

@cgillum cgillum requested a review from YunchuWang December 22, 2025 22:17
Copilot AI review requested due to automatic review settings January 6, 2026 23:59
Copy link
Contributor

Copilot AI left a 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.

Copy link
Member

@halspang halspang left a 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.

Copilot AI review requested due to automatic review settings January 23, 2026 21:54
Copy link
Contributor

Copilot AI left a 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.

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.

4 participants