Skip to content

Commit c1ae06b

Browse files
committed
Copilot Feedback
1 parent 8e68a8d commit c1ae06b

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/Aspire.Hosting.SqlServer/SqlServerBuilderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public static IResourceBuilder<SqlServerServerResource> AddSqlServer(this IDistr
9898
{
9999
var executionContext = ctx.Services.GetRequiredService<DistributedApplicationExecutionContext>();
100100

101-
// Dev cert versions prior to 6 don't include "127.0.0.1" int eh SAN, and so won't be trusted
101+
// Dev cert versions prior to 6 don't include "127.0.0.1" in the SAN, and so won't be trusted
102102
// So only enable TLS if we have a custom cert, or a dev cert with version 6 or higher.
103103
if (executionContext.IsRunMode)
104104
{

src/Aspire.Hosting.SqlServer/SqlServerServerResource.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ private ReferenceExpression BuildConnectionString()
5050
var builder = new ReferenceExpressionBuilder();
5151

5252
builder.Append($"Server={PrimaryEndpoint.Property(EndpointProperty.IPV4Host)},{PrimaryEndpoint.Property(EndpointProperty.Port)};");
53-
builder.Append($"User ID={UserNameReference};");
54-
builder.Append($"Password={PasswordParameter};");
53+
builder.Append($";User ID={UserNameReference}");
54+
builder.Append($";Password={PasswordParameter}");
5555
builder.Append($"{PrimaryEndpoint.GetTlsValue(
5656
enabledValue: ReferenceExpression.Empty,
57-
disabledValue: ReferenceExpression.Create($"TrustServerCertificate=true;"))}");
57+
disabledValue: ReferenceExpression.Create($";TrustServerCertificate=true"))}");
5858

5959
return builder.Build();
6060
}
@@ -84,12 +84,12 @@ internal ReferenceExpression BuildJdbcConnectionString(string? databaseName = nu
8484

8585
if (!string.IsNullOrEmpty(databaseName))
8686
{
87-
builder.Append($"databaseName={databaseName:uri}");
87+
builder.Append($";databaseName={databaseName:uri}");
8888
}
8989

9090
builder.Append($"{PrimaryEndpoint.GetTlsValue(
9191
enabledValue: ReferenceExpression.Empty,
92-
disabledValue: ReferenceExpression.Create($"trustServerCertificate=true;"))}");
92+
disabledValue: ReferenceExpression.Create($";trustServerCertificate=true"))}");
9393

9494
return builder.Build();
9595
}
@@ -98,10 +98,9 @@ internal ReferenceExpression BuildJdbcConnectionString(string? databaseName = nu
9898
/// Gets the JDBC connection string for the SQL Server.
9999
/// </summary>
100100
/// <remarks>
101-
/// <para>Format: <c>jdbc:sqlserver://{host}:{port}[];trustServerCertificate=true]</c>.</para>
101+
/// <para>Format: <c>jdbc:sqlserver://{Host}:{Port}[;databaseName={Database}][;trustServerCertificate=true]</c>.</para>
102102
/// <para>User and password credentials are not included in the JDBC connection string.
103-
/// Use the <see cref="UserNameReference"/> and <see cref="PasswordParameter"/> connection properties to access credentials.</para>
104-
/// </remarks>
103+
/// Use the <c>Username</c> and <c>Password</c> connection properties to access credentials.</para> /// </remarks>
105104
public ReferenceExpression JdbcConnectionString => BuildJdbcConnectionString();
106105

107106
/// <summary>
@@ -124,7 +123,7 @@ public ReferenceExpression ConnectionStringExpression
124123
/// Gets the connection string for the SQL Server.
125124
/// </summary>
126125
/// <param name="cancellationToken"> A <see cref="CancellationToken"/> to observe while waiting for the task to complete.</param>
127-
/// <returns>A connection string for the SQL Server in the form "Server=host,port;User ID=sa;Password=password", with "TrustServerCertificate=true" appended when TLS certificate material is not configured.</returns>
126+
/// <returns>A connection string for the SQL Server in the form "Server=host,port;User ID=sa;Password=password", with "TrustServerCertificate=true" appended when a certificate is not configured.</returns>
128127
public ValueTask<string?> GetConnectionStringAsync(CancellationToken cancellationToken = default)
129128
{
130129
return ConnectionStringExpression.GetValueAsync(cancellationToken);

0 commit comments

Comments
 (0)