SqlServerBuilderExtensions.AddDatabase Method

Definition

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

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);
static member AddDatabase : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.SqlServerServerResource> * string * string -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.SqlServerDatabaseResource>
<Extension()>
Public Function AddDatabase (builder As IResourceBuilder(Of SqlServerServerResource), name As String, Optional databaseName As String = Nothing) As IResourceBuilder(Of SqlServerDatabaseResource)

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