Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Enhance external parameters article with 9.2 AddConnectionString capabilities #2710

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

Closed
davidfowl opened this issue Mar 3, 2025 · 1 comment Β· Fixed by #3221
Closed

Enhance external parameters article with 9.2 AddConnectionString capabilities #2710

davidfowl opened this issue Mar 3, 2025 · 1 comment Β· Fixed by #3221
Assignees
Labels
πŸ“Œ seQUESTered Identifies that an issue has been imported into Quest.

Comments

@davidfowl
Copy link
Member

davidfowl commented Mar 3, 2025

We just merged dotnet/aspire#7826 into 9.2 which adds an overload of AddConnectionString that supports passing in a reference expression.

There are a few key things this enables:

  1. Creating adhoc connection strings made from various parameters:

    var openAiKey = builder.AddParameter("openaikey", secret: true);
    var oaiCs = builder.AddConnectionString("llm", ReferenceExpression.Create($"Endpoint=https://api.openai.com/v1;Key={openAiKey}"));
  2. Appending to existing connection strings.

     var builder = DistributedApplication.CreateBuilder(args);
    
     var postgres = builder
         .AddPostgres("postgres")
    
     var database = postgres.AddDatabase("db");
    
     var cs = builder.AddConnectionString("database", ReferenceExpression.Create($"{database};Include Error Details=true"));
    
     var backend = builder
         .AddProject<Projects.Backend>("backend")
         .WithReference(cs)
         .WaitFor(cs);
    
     builder.Build().Run();

    Waiting for a connection string will wait for the database implicitly.

This article should be updated to show the new scenarios.


Associated WorkItem - 427446

@dotnetrepoman dotnetrepoman bot added the ⌚ Not Triaged Not triaged label Mar 3, 2025
@adegeo
Copy link
Contributor

adegeo commented Apr 24, 2025

@alistairmatthews

@IEvangelist IEvangelist self-assigned this May 2, 2025
@IEvangelist IEvangelist added πŸ—ΊοΈ reQUEST Triggers an issue to be imported into Quest. and removed ⌚ Not Triaged Not triaged labels May 2, 2025
@github-project-automation github-project-automation bot moved this from πŸ”– Ready to βœ… Done in dotnet/docs April 2025 sprint project May 2, 2025
@sequestor sequestor bot added πŸ“Œ seQUESTered Identifies that an issue has been imported into Quest. and removed πŸ—ΊοΈ reQUEST Triggers an issue to be imported into Quest. labels May 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
πŸ“Œ seQUESTered Identifies that an issue has been imported into Quest.
Projects
Status: βœ… Done
Development

Successfully merging a pull request may close this issue.

3 participants