-
Notifications
You must be signed in to change notification settings - Fork 119
Refactor dapr apis #865
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
Refactor dapr apis #865
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.
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 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
IDaprPublishingHelper
interface 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.NotStarted
line 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
* 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
Closes #574
Azure Dapr Redis Integration Enhancements:
WithReference
and related methods inAzureRedisCacheDaprHostingExtensions
to 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]TryAdd
and updating how Dapr components and parameters are added to the infrastructure.CommunityToolkit.Aspire.Hosting.Azure.Dapr
to enable new extension functionality.Example AppHost Improvements:
Program.cs
in 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