Correct the use of connections strings in integration documents#314
Correct the use of connections strings in integration documents#314alistairmatthews wants to merge 7 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR corrects the documentation for database integration by removing incorrect references to ConnectionStrings__<name> environment variables and replacing them with the proper Aspire method GetConnectionString("<name>"). The double-underscore format doesn't work correctly and should not be recommended to developers.
Changes:
- Updated C# code examples to use
GetConnectionString()instead ofGetValue<string>("ConnectionStrings__<name>") - Removed
ConnectionStrings__<name>from environment variable lists in various integration documentation files - Removed entire documentation sections that demonstrated the incorrect pattern
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| qdrant-host.mdx | Removes incorrect ConnectionStrings__qdrant from environment variable list |
| qdrant-get-started.mdx | Updates C# example to use GetConnectionString and removes Python/JavaScript examples with incorrect pattern |
| mongodb-host.mdx | Removes ConnectionStrings__mongodb from environment variable list |
| milvus-host.mdx | Removes ConnectionStrings__milvusdb from environment variable list |
| milvus-get-started.mdx | Updates C# example to use GetConnectionString with var keyword |
| elasticsearch-get-started.mdx | Removes entire section about injected Elasticsearch properties |
| sql-server-client.mdx | Removes ConnectionString property from documentation table and environment variable list |
| postgresql-client.mdx | Removes ConnectionString from table and updates explanatory text |
| oracle-host.mdx | Removes ConnectionStrings__oracledb from environment variable list |
| mysql-get-started.mdx | Updates C# example to use GetConnectionString with var keyword |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-get-started.mdx
Show resolved
Hide resolved
src/frontend/src/content/docs/integrations/databases/milvus/milvus-get-started.mdx
Show resolved
Hide resolved
src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-host.mdx
Show resolved
Hide resolved
…section after feedback from @Copilot.
…nnection-string-code
|
|
||
| The following environment variables are available in the Python application: | ||
|
|
||
| - `ConnectionStrings__oracledb` - The connection string for the Oracle database |
There was a problem hiding this comment.
Is this true? I thought connection strings were still present.
...frontend/src/content/docs/integrations/databases/elasticsearch/elasticsearch-get-started.mdx
Outdated
Show resolved
Hide resolved
|
Closing to re-trigger checks. |
|
I think it's ok to replace usages of |
Although in the Dashboard there is often an environment variable such as ConnectionStrings__postgresdb listed, this shouldn't be used in .NET code for two reasons:
var connectionUri = builder.Configuration.GetConnectionString("postgresdb");The double-underscore version is correct for Python and JavaScript examples.
Fixes: #312