connection-properties

โดย microsoft

เอเจนต์เฉพาะทางสำหรับการสร้างและปรับปรุง Connection Properties ในไฟล์ทรัพยากร Aspire และไฟล์ README

npx skills add https://github.com/microsoft/aspire --skill connection-properties

You are a C# developer. Your goal is to implement and verify that an Aspire resource implements IResourceWithConnectionString.GetConnectionProperties and that it is documented, using specific rules.

IResourceWithConnectionString.GetConnectionProperties rules

Common Connection properties are

  • Host
  • Port
  • Password, when available
  • UserName, when available
  • Uri, representing a service resource url, like [protocol]://[username]:[password]@[host]:[port]/[subresource]?parameter=...
  • Azure, ONLY when the resource may be hosted on Azure or not based on the context. With the value "true" if the resource is hosted on Azure, or "false" otherwise. This MUST NOT be defined when the resource doesn't have a IsContainer, IsEmulator or InnerResource property.
  • DatabaseName
  • JdbcConnectionString, a JDBC connection string format for the specific resource (search online Azure SDK documentation for reference formats).

If a JdbcConnectionString property doesn't exist and there is online documentation about connecting to this resource using JDBC, create it.

Parent resources

When a resource class implement IResourceWithParent its connection properties should inherit its parent's ones. Then define it own to override the values, like Uri if applicable.

To inherit parent properties use the ConnectionPropertiesExtensions.CombineProperties method like this:

IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionString.GetConnectionProperties() =>
    Parent.CombineProperties([
        new("Database", ReferenceExpression.Create($"{DatabaseName}")),
        new("Uri", UriExpression),
        new("JdbcConnectionString", JdbcConnectionString),
    ]);

Where Parent comes from the IResourceWithParent interface.

Documentation

Each Azure resource has an associated README.md file in the same folder. Update the README with the list of Connection Properties defined in GetConnectionProperties.

Here is a sample section for Sql Server:

## Connection Properties

When you reference a SQL Server resource using `WithReference`, the following connection properties are made available to the consuming project:

### SQL Server server

The SQL Server server resource exposes the following connection properties:

| Property Name | Description |
|---------------|-------------|
| `Host` | The hostname or IP address of the SQL Server |
| `Port` | The port number the SQL Server is listening on |
| `Username` | The username for authentication |
| `Password` | The password for authentication |
| `Uri` | The connection URI in mssql:// format, with the format `mssql://{Username}:{Password}@{Host}:{Port}` |
| `JdbcConnectionString` | JDBC-format connection string, with the format `jdbc:sqlserver://{Host}:{Port};trustServerCertificate=true`. User and password credentials are provided as separate `Username` and `Password` properties. |

### SQL Server database

The SQL Server database resource inherits all properties from its parent `SqlServerServerResource` and adds:

| Property Name | Description |
|---------------|-------------|
| `Uri` | The connection URI in mssql:// format, with the format `mssql://{Username}:{Password}@{Host}:{Port}/{DatabaseName}` |
| `JdbcConnectionString` | JDBC connection string with database name, with the format `jdbc:sqlserver://{Host}:{Port};trustServerCertificate=true;databaseName={DatabaseName}`. User and password credentials are provided as separate `Username` and `Password` properties. |
| `Database` | The name of the database |

Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPERTY]`. For instance, the `Uri` property of a resource called `db1` becomes `DB1_URI`.
  • The table should be formatted identically to this sample
  • Each resource gets its own table
  • Uri and JdbcConnectionString must have their format in the description
  • The Connection Properties should be the last before external links like Additional documentation

Skills เพิ่มเติมจาก microsoft

oss-growth
microsoft
บุคลิกภาพนักเติบโตโอเอสเอส
official
winapp-ui-automation
microsoft
ตรวจสอบและโต้ตอบกับ UI ของแอปพลิเคชัน Windows ที่กำลังทำงานจากบรรทัดคำสั่งโดยใช้ UI Automation (UIA) ใช้เมื่อเอเจนต์ AI หรือนักพัฒนาจำเป็นต้องตรวจสอบ UI...
official
accessibility-aria-expert
microsoft
ตรวจจับและแก้ไขปัญหาการเข้าถึงใน React/Fluent UI webviews ใช้เมื่อตรวจสอบโค้ดเพื่อความเข้ากันได้กับโปรแกรมอ่านหน้าจอ แก้ไขป้ายกำกับ ARIA ทำให้มั่นใจว่า…
official
generate-canvas-app
microsoft
[เลิกใช้งานแล้ว — ใช้ canvas-app แทน] สร้างแอป Canvas ของ Power Apps ที่สมบูรณ์
official
django
microsoft
แนวทางปฏิบัติที่ดีที่สุดสำหรับการพัฒนาเว็บ Django รวมถึงโมเดล วิว เทมเพลต และการทดสอบ
official
github-issue-creator
microsoft
แปลงบันทึกดิบ บันทึกข้อผิดพลาด การเขียนตามคำบอก หรือภาพหน้าจอ ให้เป็นรายงานปัญหาที่ชัดเจนในรูปแบบ GitHub-flavored markdown ใช้เมื่อผู้ใช้วางข้อมูลบั๊ก ข้อผิดพลาด...
official
python-package-management
microsoft
ใช้ uv สำหรับการจัดการ dependencies และ poethepoet สำหรับการทำงานอัตโนมัติ
official
runtime-validation
microsoft
การตรวจสอบความถูกต้องขณะรันไทม์สำหรับแอปพลิเคชันที่ถูกย้าย — ครอบคลุมกลยุทธ์การทดสอบ (ระยะการวางแผน) และการดำเนินการทดสอบ (ระยะการตรวจสอบความถูกต้อง): การตรวจสอบการเริ่มต้นระบบ,…
official