Skip to content
Discussion options

You must be logged in to vote

See #2964.

Today you would have to build the connection string manually:

var builder = DistributedApplication.CreateBuilder(args);

var db = builder.AddSqlServer("sql-svr")
                .AddDatabase("db");

builder.AddProject<Projects.WebApplication1>("webapplication1")
       .WithEnvironment($"ConnectionStrings__{db.Resource.Name}",  $"{db.Resource};MultipleActiveResultSets=true");

builder.Build().Run();

We have a special string interpolation handler that captures the right information.

If you want to reuse this in multiple calls then you can do:

var builder = DistributedApplication.CreateBuilder(args);

var db = builder.AddSqlServer("sql-svr")
                .AddDatabase("db");

var 

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Kralizek
Comment options

@Kralizek
Comment options

Answer selected by Kralizek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants