Refactor dapr apis#865
Merged
aaronpowell merged 19 commits intoCommunityToolkit:mainfrom Sep 23, 2025
Merged
Conversation
- Added project reference to `CommunityToolkit.Aspire.Hosting.Dapr.csproj` in the Azure Dapr project file. - Updated `IDistributedApplicationBuilderExtensions.cs` with documentation for Dapr-related extension methods. - Introduced `CommandLineBuilder.cs` for building Dapr CLI command line arguments. - Modified and added classes for Dapr components, improving configuration and management. - Refactored `DaprDistributedApplicationLifecycleHook` to manage Dapr sidecar lifecycles and on-demand components. - Introduced new annotations and options classes for better Dapr component configuration. - Improved organization and clarity of Dapr-related classes with additional comments and documentation.
- Added project reference to `CommunityToolkit.Aspire.Hosting.Dapr.csproj` in the Azure Dapr project file. - Updated `IDistributedApplicationBuilderExtensions.cs` with documentation for Dapr-related extension methods. - Introduced `CommandLineBuilder.cs` for building Dapr CLI command line arguments. - Modified and added classes for Dapr components, improving configuration and management. - Refactored `DaprDistributedApplicationLifecycleHook` to manage Dapr sidecar lifecycles and on-demand components. - Introduced new annotations and options classes for better Dapr component configuration. - Improved organization and clarity of Dapr-related classes with additional comments and documentation.
This commit introduces Azure Dapr support within the CommunityToolkit.Aspire.Hosting framework. Key changes include: - Added setup for Azure Container Apps and Redis state management in Program.cs, enhancing Dapr sidecar configuration. - Modified AzureDaprPublishingHelper to implement specific Dapr publishing requirements. - Updated IDistributedApplicationBuilderExtensions with lifecycle hooks and improved configuration options. - Introduced azure.yaml for defining the Azure Container App environment and project structure. - Added documentation in next-steps.md to guide users on post-initialization steps for Azure deployment. - Created AzureContainerAppEnvironmentResourceBuilderExtensions for configuring Azure Container App resources for Dapr. - Updated .gitignore to exclude Azure-related files for a cleaner repository.
Updated `Program.cs` to add Dapr components configuration through the new `WithDaprComponents()` method. Renamed `WithDapr()` to `WithDaprComponents()` in `AzureContainerAppEnvironmentResourceBuilderExtensions.cs`, and restructured the method to prepare for Dapr component handling, with the implementation currently commented out for future development.
- Added project reference to `CommunityToolkit.Aspire.Hosting.Dapr.csproj` in the Azure Dapr project file. - Updated `IDistributedApplicationBuilderExtensions.cs` with documentation for Dapr-related extension methods. - Introduced `CommandLineBuilder.cs` for building Dapr CLI command line arguments. - Modified and added classes for Dapr components, improving configuration and management. - Refactored `DaprDistributedApplicationLifecycleHook` to manage Dapr sidecar lifecycles and on-demand components. - Introduced new annotations and options classes for better Dapr component configuration. - Improved organization and clarity of Dapr-related classes with additional comments and documentation.
- Added project reference to `CommunityToolkit.Aspire.Hosting.Dapr.csproj` in the Azure Dapr project file. - Updated `IDistributedApplicationBuilderExtensions.cs` with documentation for Dapr-related extension methods. - Introduced `CommandLineBuilder.cs` for building Dapr CLI command line arguments. - Modified and added classes for Dapr components, improving configuration and management. - Refactored `DaprDistributedApplicationLifecycleHook` to manage Dapr sidecar lifecycles and on-demand components. - Introduced new annotations and options classes for better Dapr component configuration. - Improved organization and clarity of Dapr-related classes with additional comments and documentation.
This commit introduces Azure Dapr support within the CommunityToolkit.Aspire.Hosting framework. Key changes include: - Added setup for Azure Container Apps and Redis state management in Program.cs, enhancing Dapr sidecar configuration. - Modified AzureDaprPublishingHelper to implement specific Dapr publishing requirements. - Updated IDistributedApplicationBuilderExtensions with lifecycle hooks and improved configuration options. - Introduced azure.yaml for defining the Azure Container App environment and project structure. - Added documentation in next-steps.md to guide users on post-initialization steps for Azure deployment. - Created AzureContainerAppEnvironmentResourceBuilderExtensions for configuring Azure Container App resources for Dapr. - Updated .gitignore to exclude Azure-related files for a cleaner repository.
Updated `Program.cs` to add Dapr components configuration through the new `WithDaprComponents()` method. Renamed `WithDapr()` to `WithDaprComponents()` in `AzureContainerAppEnvironmentResourceBuilderExtensions.cs`, and restructured the method to prepare for Dapr component handling, with the implementation currently commented out for future development.
This commit removes the entire `IDistributedApplicationBuilderExtensions` class, including methods for adding Dapr components, pub-sub components, and state store components. All associated lifecycle management and manifest writing functionality, along with related comments and documentation, have also been deleted.
Enhance Dapr component integration by improving method chaining in `Program.cs`, adding metadata handling for dynamic configuration, and introducing lifecycle management methods. Update unit tests for new functionalities, remove redundant code, and improve test structure. Support managed identity and access key authentication for Redis, and enhance the `WithMetadata` method to accept various metadata types.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the Dapr integration to remove the IDaprPublishingHelper abstraction and simplify the sidecar reference pattern. The primary changes include moving shared Dapr functionality from the shared folder into the core Dapr package and updating the Azure Dapr Redis integration to use a more streamlined approach for component reference handling.
Key changes:
- Removed the
IDaprPublishingHelperinterface and related implementations in favor of a direct configuration action approach - Updated sidecar reference pattern to use lambda configuration for better component attachment
- Consolidated Azure Dapr Redis reference logic to support both access key and managed identity authentication through unified methods
Reviewed Changes
Copilot reviewed 28 out of 48 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Shared/Dapr/Core/* | Removed shared Dapr core files that were moved to the main Dapr package |
| src/CommunityToolkit.Aspire.Hosting.Dapr/* | Added consolidated Dapr functionality and simplified publishing approach |
| src/CommunityToolkit.Aspire.Hosting.Azure.Dapr/* | Removed publishing helper and updated to use direct configuration actions |
| src/CommunityToolkit.Aspire.Hosting.Azure.Dapr.Redis/* | Refactored Redis component configuration to support both auth methods cleanly |
| tests/* | Updated tests to use new sidecar lambda pattern and verify component references |
| examples/* | Updated example applications to demonstrate new sidecar reference patterns |
Comments suppressed due to low confidence (1)
src/CommunityToolkit.Aspire.Hosting.Dapr/IDistributedApplicationComponentBuilderExtensions.cs:1
- The
State = KnownResourceStates.NotStartedline was removed but this appears to be needed for proper resource lifecycle management. Consider whether this removal was intentional.
// Licensed to the .NET Foundation under one or more agreements.
src/CommunityToolkit.Aspire.Hosting.Dapr/IDistributedApplicationComponentBuilderExtensions.cs
Show resolved
Hide resolved
src/CommunityToolkit.Aspire.Hosting.Azure.Dapr.Redis/AzureRedisCacheDaprHostingExtensions.cs
Show resolved
Hide resolved
…move redundant checks
aaronpowell
approved these changes
Sep 23, 2025
FullStackChef
added a commit
to FullStackChef/CommunityToolkit-Aspire
that referenced
this pull request
Sep 26, 2025
* Enhance Dapr support in Aspire framework - Added project reference to `CommunityToolkit.Aspire.Hosting.Dapr.csproj` in the Azure Dapr project file. - Updated `IDistributedApplicationBuilderExtensions.cs` with documentation for Dapr-related extension methods. - Introduced `CommandLineBuilder.cs` for building Dapr CLI command line arguments. - Modified and added classes for Dapr components, improving configuration and management. - Refactored `DaprDistributedApplicationLifecycleHook` to manage Dapr sidecar lifecycles and on-demand components. - Introduced new annotations and options classes for better Dapr component configuration. - Improved organization and clarity of Dapr-related classes with additional comments and documentation. * Enhance Dapr support in Aspire framework - Added project reference to `CommunityToolkit.Aspire.Hosting.Dapr.csproj` in the Azure Dapr project file. - Updated `IDistributedApplicationBuilderExtensions.cs` with documentation for Dapr-related extension methods. - Introduced `CommandLineBuilder.cs` for building Dapr CLI command line arguments. - Modified and added classes for Dapr components, improving configuration and management. - Refactored `DaprDistributedApplicationLifecycleHook` to manage Dapr sidecar lifecycles and on-demand components. - Introduced new annotations and options classes for better Dapr component configuration. - Improved organization and clarity of Dapr-related classes with additional comments and documentation. * Integrate Azure Dapr support into CommunityToolkit This commit introduces Azure Dapr support within the CommunityToolkit.Aspire.Hosting framework. Key changes include: - Added setup for Azure Container Apps and Redis state management in Program.cs, enhancing Dapr sidecar configuration. - Modified AzureDaprPublishingHelper to implement specific Dapr publishing requirements. - Updated IDistributedApplicationBuilderExtensions with lifecycle hooks and improved configuration options. - Introduced azure.yaml for defining the Azure Container App environment and project structure. - Added documentation in next-steps.md to guide users on post-initialization steps for Azure deployment. - Created AzureContainerAppEnvironmentResourceBuilderExtensions for configuring Azure Container App resources for Dapr. - Updated .gitignore to exclude Azure-related files for a cleaner repository. * Enhance Azure Container App Dapr integration Updated `Program.cs` to add Dapr components configuration through the new `WithDaprComponents()` method. Renamed `WithDapr()` to `WithDaprComponents()` in `AzureContainerAppEnvironmentResourceBuilderExtensions.cs`, and restructured the method to prepare for Dapr component handling, with the implementation currently commented out for future development. * Enhance Dapr support in Aspire framework - Added project reference to `CommunityToolkit.Aspire.Hosting.Dapr.csproj` in the Azure Dapr project file. - Updated `IDistributedApplicationBuilderExtensions.cs` with documentation for Dapr-related extension methods. - Introduced `CommandLineBuilder.cs` for building Dapr CLI command line arguments. - Modified and added classes for Dapr components, improving configuration and management. - Refactored `DaprDistributedApplicationLifecycleHook` to manage Dapr sidecar lifecycles and on-demand components. - Introduced new annotations and options classes for better Dapr component configuration. - Improved organization and clarity of Dapr-related classes with additional comments and documentation. * Enhance Dapr support in Aspire framework - Added project reference to `CommunityToolkit.Aspire.Hosting.Dapr.csproj` in the Azure Dapr project file. - Updated `IDistributedApplicationBuilderExtensions.cs` with documentation for Dapr-related extension methods. - Introduced `CommandLineBuilder.cs` for building Dapr CLI command line arguments. - Modified and added classes for Dapr components, improving configuration and management. - Refactored `DaprDistributedApplicationLifecycleHook` to manage Dapr sidecar lifecycles and on-demand components. - Introduced new annotations and options classes for better Dapr component configuration. - Improved organization and clarity of Dapr-related classes with additional comments and documentation. * Integrate Azure Dapr support into CommunityToolkit This commit introduces Azure Dapr support within the CommunityToolkit.Aspire.Hosting framework. Key changes include: - Added setup for Azure Container Apps and Redis state management in Program.cs, enhancing Dapr sidecar configuration. - Modified AzureDaprPublishingHelper to implement specific Dapr publishing requirements. - Updated IDistributedApplicationBuilderExtensions with lifecycle hooks and improved configuration options. - Introduced azure.yaml for defining the Azure Container App environment and project structure. - Added documentation in next-steps.md to guide users on post-initialization steps for Azure deployment. - Created AzureContainerAppEnvironmentResourceBuilderExtensions for configuring Azure Container App resources for Dapr. - Updated .gitignore to exclude Azure-related files for a cleaner repository. * Enhance Azure Container App Dapr integration Updated `Program.cs` to add Dapr components configuration through the new `WithDaprComponents()` method. Renamed `WithDapr()` to `WithDaprComponents()` in `AzureContainerAppEnvironmentResourceBuilderExtensions.cs`, and restructured the method to prepare for Dapr component handling, with the implementation currently commented out for future development. * Refactor Dapr integration for Azure Redis Cache Enhance Dapr component integration by improving method chaining in `Program.cs`, adding metadata handling for dynamic configuration, and introducing lifecycle management methods. Update unit tests for new functionalities, remove redundant code, and improve test structure. Support managed identity and access key authentication for Redis, and enhance the `WithMetadata` method to accept various metadata types. * Delete examples/dapr/CommunityToolkit.Aspire.Hosting.Azure.Dapr.AppHost/.gitignore * Delete examples/dapr/CommunityToolkit.Aspire.Hosting.Azure.Dapr.AppHost/azure.yaml * Delete examples/dapr/CommunityToolkit.Aspire.Hosting.Azure.Dapr.AppHost/next-steps.md * Add tests for Dapr component references and sidecar functionality * remove sln file * Enhance Dapr sidecar configuration with default AppId and options handling * Refactor Dapr sidecar configuration to simplify AppId handling and remove redundant checks
This was referenced Sep 29, 2025
This was referenced Oct 7, 2025
This was referenced Dec 8, 2025
This was referenced Jan 5, 2026
Closed
Closed
This was referenced Jan 19, 2026
This was referenced Feb 8, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #574
Azure Dapr Redis Integration Enhancements:
WithReferenceand related methods inAzureRedisCacheDaprHostingExtensionsto more cleanly support both access key and managed identity authentication for Dapr state and pubsub components, including dynamic metadata configuration and output provisioning. [1] [2]TryAddand updating how Dapr components and parameters are added to the infrastructure.CommunityToolkit.Aspire.Hosting.Azure.Daprto enable new extension functionality.Example AppHost Improvements:
Program.csin the example project to use the new Dapr component reference patterns, including improved sidecar and metadata configuration for state store and pubsub, and to leverage the new AzureContainerAppEnvironment. [1] [2]PR Checklist
Other information