SqlServerBuilderExtensions.AddSqlServer Method

Definition

Adds a SQL Server resource to the application model. A container is used for local development.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.SqlServerServerResource> AddSqlServer (this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>? password = default, int? port = default);

Parameters

name
String

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

password
IResourceBuilder<ParameterResource>

The parameter used to provide the administrator password for the SQL Server resource. If null a random password will be generated.

port
Nullable<Int32>

The host port for the SQL Server.

Returns

A reference to the IResourceBuilder<T>.

Remarks

This version of the package defaults to the tag of the / container image.

Applies to