SqlServerBuilderExtensions.AddDatabase Method

Definition

Adds a SQL Server database to the application model. This is a child resource of a SqlServerServerResource.

C#
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.SqlServerDatabaseResource> AddDatabase(this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.SqlServerServerResource> builder, string name, string? databaseName = default);

Parameters

builder
IResourceBuilder<SqlServerServerResource>

The SQL Server resource builders.

name
String

The name of the resource. This name will be used as the connection string name when referenced in a dependency.

databaseName
String

The name of the database. If not provided, this defaults to the same value as name.

Returns

A reference to the IResourceBuilder<T>.

Applies to

Product Versions
.NET Aspire 8.0.0, 9.0.0, 9.1.0