Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 5, 2025

The source generator was not producing Azure Function triggers for entities when using the class-based syntax with [DurableTask] attribute, unlike orchestrators and activities which already had this support.

Changes

  • DurableTaskSourceGenerator.cs: Added AddEntityFunctionDeclaration method that generates [EntityTrigger] function definitions for entity classes decorated with [DurableTask]
  • AzureFunctionsTests.cs: Added 6 tests covering entity generation with primitive types, inheritance, custom state types, and mixed orchestrator/activity/entity scenarios

Example

Given:

[DurableTask(nameof(MyEntity))]
public class MyEntity : TaskEntity<int>
{
    public int Get() => this.State;
}

The generator now produces:

[Function(nameof(MyEntity))]
public static Task MyEntity([EntityTrigger] TaskEntityDispatcher dispatcher)
{
    return dispatcher.DispatchAsync<MyEntity>();
}
Original prompt

add durable function entity source generation support and tests properly


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add durable function entity source generation support and tests Add entity source generation support for Durable Functions Dec 5, 2025
Copilot AI requested a review from YunchuWang December 5, 2025 17:47
Copilot finished work on behalf of YunchuWang December 5, 2025 17:47
@YunchuWang YunchuWang marked this pull request as ready for review December 5, 2025 20:16
Copilot AI review requested due to automatic review settings December 5, 2025 20:16
Copy link

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 source generation support for Durable Task entities in Azure Functions scenarios. Previously, the source generator only produced function triggers for orchestrators and activities when using the class-based [DurableTask] attribute syntax. This change brings entities to feature parity by generating [EntityTrigger] function definitions.

Key Changes:

  • Added AddEntityFunctionDeclaration method to generate entity trigger functions
  • Added 4 comprehensive test methods covering primitive types, inheritance, custom state types, and mixed scenarios

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Generators/DurableTaskSourceGenerator.cs Added entity function generation logic in the Execute method and implemented the AddEntityFunctionDeclaration helper method following existing patterns
test/Generators.Tests/AzureFunctionsTests.cs Added 4 test methods validating entity generation across different scenarios including primitive types, inheritance, custom state types, and mixed orchestrator/activity/entity usage

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.

2 participants