AddDatabase registers a named database under a database-server resource and creates the database automatically using provider-specific SQL. The name also identifies the database resource for service discovery. Unlike Aspire 8, current behavior creates the database rather than only adding a reference and connection string. section 3.3
var sql = builder.AddSqlServer("sql").WithLifetime(ContainerLifetime.Persistent);
var sqldb = sql.AddDatabase("sqldb");
var apiService = builder
.AddProject<Projects.OnlineShop_ApiService>("apiservice")
.WithHttpHealthCheck("/health")
.WithReference(idp)
.WaitFor(idp)
.WaitFor(sqldb)
.WithReference(sqldb);
See the SQL Server registration and how an API service waits for and references the database resource. section 3.3
