Skip to content

Fix incorrect XML documentation in database AddDatabase methods for PostgreSQL, MySQL, and SQL Server #10866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Aspire.Hosting.MySql/MySqlBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ public static IResourceBuilder<MySqlServerResource> AddMySql(this IDistributedAp
/// <param name="name">The name of the resource. This name will be used as the connection string name when referenced in a dependency.</param>
/// <param name="databaseName">The name of the database. If not provided, this defaults to the same value as <paramref name="name"/>.</param>
/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
/// <remarks>
/// <para>
/// When adding a <see cref="MySqlDatabaseResource"/> to your application model the resource can then
/// be referenced by other resources using the resource name. When the dependent resource is using
/// the extension method <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
/// then the dependent resource will wait until the MySQL database is available.
/// </para>
/// <para>
/// Note that calling <see cref="AddDatabase(IResourceBuilder{MySqlServerResource}, string, string?)"/>
/// will result in the database being created on the MySQL server when the server becomes ready.
/// The database creation happens automatically as part of the resource lifecycle.
/// </para>
/// </remarks>
public static IResourceBuilder<MySqlDatabaseResource> AddDatabase(this IResourceBuilder<MySqlServerResource> builder, [ResourceName] string name, string? databaseName = null)
{
ArgumentNullException.ThrowIfNull(builder);
Expand Down
7 changes: 3 additions & 4 deletions src/Aspire.Hosting.PostgreSQL/PostgresBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,9 @@ public static IResourceBuilder<PostgresServerResource> AddPostgres(this IDistrib
/// extension method then the dependent resource will wait until the Postgres database is available.
/// </para>
/// <para>
/// Note that by default calling <see cref="AddDatabase(IResourceBuilder{PostgresServerResource}, string, string?)"/>
/// does not result in the database being created on the Postgres server. It is expected that code within your solution
/// will create the database. As a result if <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
/// is used with this resource it will wait indefinitely until the database exists.
/// Note that calling <see cref="AddDatabase(IResourceBuilder{PostgresServerResource}, string, string?)"/>
/// will result in the database being created on the Postgres server when the server becomes ready.
/// The database creation happens automatically as part of the resource lifecycle.
Copy link
Preview

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated documentation should clarify when exactly the database creation occurs. Consider adding that it happens during the ResourceReadyEvent to be more specific about the timing.

Suggested change
/// The database creation happens automatically as part of the resource lifecycle.
/// Specifically, the database creation occurs during the <c>ResourceReadyEvent</c> as part of the resource lifecycle.

Copilot uses AI. Check for mistakes.

/// </para>
/// </remarks>
public static IResourceBuilder<PostgresDatabaseResource> AddDatabase(this IResourceBuilder<PostgresServerResource> builder, [ResourceName] string name, string? databaseName = null)
Expand Down
13 changes: 13 additions & 0 deletions src/Aspire.Hosting.SqlServer/SqlServerBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,19 @@ public static IResourceBuilder<SqlServerServerResource> AddSqlServer(this IDistr
/// <param name="name">The name of the resource. This name will be used as the connection string name when referenced in a dependency.</param>
/// <param name="databaseName">The name of the database. If not provided, this defaults to the same value as <paramref name="name"/>.</param>
/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
/// <remarks>
/// <para>
/// When adding a <see cref="SqlServerDatabaseResource"/> to your application model the resource can then
/// be referenced by other resources using the resource name. When the dependent resource is using
/// the extension method <see cref="ResourceBuilderExtensions.WaitFor{T}(IResourceBuilder{T}, IResourceBuilder{IResource})"/>
/// then the dependent resource will wait until the SQL Server database is available.
/// </para>
/// <para>
/// Note that calling <see cref="AddDatabase(IResourceBuilder{SqlServerServerResource}, string, string?)"/>
/// will result in the database being created on the SQL Server when the server becomes ready.
/// The database creation happens automatically as part of the resource lifecycle.
/// </para>
/// </remarks>
public static IResourceBuilder<SqlServerDatabaseResource> AddDatabase(this IResourceBuilder<SqlServerServerResource> builder, [ResourceName] string name, string? databaseName = null)
{
ArgumentNullException.ThrowIfNull(builder);
Expand Down
Loading