-
Notifications
You must be signed in to change notification settings - Fork 133
Implement GetConnectionProperties for new connection string formatting #916
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
base: aspire-13
Are you sure you want to change the base?
Conversation
…ng resources Co-authored-by: aaronpowell <[email protected]>
| /// <inheritdoc /> | ||
| public ReferenceExpression ConnectionStringExpression => | ||
| ReferenceExpression.Create( | ||
| $"{scheme}://{UserNameReference}:{PasswordParameter}@{PrimaryEndpoint.Property(EndpointProperty.Host)}:{PrimaryEndpoint.Property(EndpointProperty.Port)}"); |
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.
At what point will it be able to use the encoding from 13.0 (Password:uri)?
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.
@sebastienros sorry, I'm not sure I'm following
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.
You can add :uri formatter suffix on values that need to be url-encoded:
ReferenceExpression.Create(
$"{scheme}://{UserNameReference}:{PasswordParameter:uri}@{PrimaryEndpoint.Property(EndpointProperty.Host)}:{PrimaryEndpoint.Property(EndpointProperty.Port)}");
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.
Well, TIL.
@copilot can you do this
Minimum allowed line rate is |
Overview
This PR implements support for the new connection string formatting introduced in dotnet/aspire#11938. All CommunityToolkit resources that implement
IResourceWithConnectionStringnow expose connection metadata as individual properties through the newGetConnectionProperties()method.Changes
The upstream Aspire PR introduces a new structure for handling connection strings, where resources expose connection information as a collection of key-value pairs rather than just a constructed connection string. This enables:
Implementation Details
For each resource implementing
IResourceWithConnectionString, this PR adds:Host,Port, and other relevant properties exposed asEndpointReferenceExpressionUriExpressionproperty that provides URI-formatted connection stringsExample for server resources:
For child resources (databases, namespaces, models), the implementation uses
CombineProperties()to merge parent connection properties with child-specific ones:Updated Resources
The following integration packages have been updated:
ActiveMQServerResourceBase(base class for Classic and Artemis)EventStoreResourceFlagdResourceGoFeatureFlagResourceMailPitContainerResourceMeilisearchResourceOllamaResource,OllamaModelResource,OpenWebUIResourcePapercutSmtpContainerResourceRavenDBServerResource,RavenDBDatabaseResourceSolrResourceSqliteResource,SqliteWebResourceSurrealDbServerResource,SurrealDbNamespaceResource,SurrealDbDatabaseResourceCompatibility
This is a breaking change that aligns with the Aspire 13.0 major version release. All implementations follow the same patterns established in the upstream Aspire resources (PostgreSQL, MySQL, Redis, MongoDB, etc.).
Fixes #889
cc @sebastienros
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
dnceng.pkgs.visualstudio.comdotnet build --no-restore /p:TargetFramework=net9.0 src/CommunityToolkit.Aspire.Hosting.EventStore/CommunityToolkit.Aspire.Hosting.EventStore.csproj(dns block)dotnet restore(dns block)dotnet workload restore(dns block)https://api.github.com/repos/dotnet/aspire/pulls/11938curl -s -H Accept: application/vnd.github.v3+json REDACTED(http block)ofvvsblobprodcus315.vsblob.vsassets.iodotnet restore(dns block)dotnet workload restore(dns block)dotnet build --no-restore(dns block)u6ovsblobprodcus377.vsblob.vsassets.iodotnet restore CommunityToolkit.Aspire.Hosting.EventStore/CommunityToolkit.Aspire.Hosting.EventStore.csproj(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Fixes #889
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.