-
Notifications
You must be signed in to change notification settings - Fork 53
Add TaskEntity support to DurableTaskSourceGenerator #517
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 TaskEntity<TState> support to the DurableTask source generator, fixing a bug where entities were excluded from the AddAllGeneratedTasks() registration method. The implementation properly handles entities' single type parameter (TState) versus the two type parameters (TInput, TOutput) used by orchestrators and activities.
Key changes:
- Added TaskEntity detection logic to the source generator with a DurableTaskKind enum to distinguish between orchestrators, activities, and entities
- Updated source generation to emit
builder.AddEntity<T>()calls in the registration method - Added comprehensive test coverage for entity scenarios including primitive types, custom types, explicit naming, inheritance, and mixed task types
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Generators/DurableTaskSourceGenerator.cs | Core implementation: Added TaskEntity detection in type hierarchy traversal, introduced DurableTaskKind enum to replace boolean flag, updated type parameter validation logic for entities (1 param) vs orchestrators/activities (2 params), and added entity registration generation |
| src/Generators/AzureFunctions/DurableFunction.cs | Added Entity enum value to DurableFunctionKind for future Azure Functions entity support |
| src/Abstractions/DurableTaskAttribute.cs | Updated XML documentation to mention TaskEntity support and entity registration |
| test/Generators.Tests/ClassBasedSyntaxTests.cs | Added comprehensive test coverage with 5 new test methods covering primitive types, custom types, explicit naming, inheritance, and mixed orchestrator/activity/entity scenarios |
|
@copilot add tests to validate azure function entity source generation |
Added Azure Functions entity source generation tests in commit 09a7cf1. The tests include:
The tests are skipped with the same reason as existing Azure Functions tests ("Durable Functions Extension out of date") since the Azure Functions extension needs to be updated to run these tests. |
Co-Authored-By: YunchuWang <[email protected]>
09a7cf1 to
5abe338
Compare
|
the function source genereator tests are all skipped currently, out of scope for this pr that fixes customer concern on non function entity source generation missing issue. we can address in separate pr. |
DurableTaskSourceGenerator.csto recognizeTaskEntity<T>base classes in addition toTaskOrchestratorandTaskActivityDurableTaskSourceGenerator.csto categorize entities separately (like activities and orchestrators)AddRegistrationMethodForAllTasksto includebuilder.AddEntity<T>()calls for entitiesDurableFunction.csto includeEntityenum value forDurableFunctionKindDurableTaskAttribute.csdocumentation to mention entitiesOriginal 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.