-
Notifications
You must be signed in to change notification settings - Fork 52
Add entity source generation support for Durable Functions #533
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
Conversation
Co-authored-by: YunchuWang <[email protected]>
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 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
AddEntityFunctionDeclarationmethod 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 |
|
sample is fixed, all source generation work as expected |
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
AddEntityFunctionDeclarationmethod that generates[EntityTrigger]function definitions for entity classes decorated with[DurableTask]Example
Given:
The generator now produces:
Original prompt
💡 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.