Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

SqlServerServerResource

Handle
📦 Aspire.Hosting.SqlServer v17.0.0

A resource that represents a SQL Server container.

type SqlServerServerResource interface {
ExpressionValue
IComputeResource
Resource
ResourceWithArgs
ResourceWithConnectionString
ResourceWithEndpoints
ResourceWithEnvironment
ResourceWithWaitSupport
}

Properties

propertyConnectionStringExpression*ReferenceExpressionget
Gets the connection string expression for the SQL Server.
ConnectionStringExpression() *ReferenceExpression
propertyDatabasesmap[string]stringget
A dictionary where the key is the resource name and the value is the database name.
Databases() (map[string]string, error)
propertyHostEndpointReferenceExpressionget
Gets the host endpoint reference for this resource.
Host() EndpointReferenceExpression
propertyJdbcConnectionString*ReferenceExpressionget
Gets the JDBC connection string for the SQL Server.
JdbcConnectionString() *ReferenceExpression
propertyPasswordParameterParameterResourceget · set
Gets the parameter that contains the SQL Server password.
PasswordParameter() ParameterResource
SetPasswordParameter(value ParameterResource) SqlServerServerResource
propertyPortEndpointReferenceExpressionget
Gets the port endpoint reference for this resource.
Port() EndpointReferenceExpression
propertyPrimaryEndpointEndpointReferenceget
Gets the primary endpoint for the SQL Server.
PrimaryEndpoint() EndpointReference
propertyResourceTypeDisplayNamestringget
Gets the ResourceTypeDisplayName property
ResourceTypeDisplayName() (string, error)
propertyUriExpression*ReferenceExpressionget
Gets the connection URI expression for the SQL Server.
UriExpression() *ReferenceExpression
propertyUserNameReference*ReferenceExpressionget
Gets a reference to the user name for the SQL Server.
UserNameReference() *ReferenceExpression

Methods

methodAddDatabasebuilder
Adds a SQL Server database resource
AddDatabase(
name string,
options ...*AddDatabaseOptions,
) SqlServerDatabaseResource
namestringThe name of the resource. This name will be used as the connection string name when referenced in a dependency.
options...*AddDatabaseOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*AddDatabaseOptions argument.

DatabaseName*stringThe name of the database. If not provided, this defaults to the same value as name.
SqlServerDatabaseResource

The resource builder.

Returns a handle; failures surface later via Err().

methodWithDataBindMountbuilder
Adds a bind mount for the data folder to a SQL Server resource.
WithDataBindMount(
source string,
options ...*WithDataBindMountOptions,
) SqlServerServerResource
sourcestringThe source directory on the host to mount into the container.
options...*WithDataBindMountOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithDataBindMountOptions argument.

IsReadOnly*boolA flag that indicates if this is a read-only mount.
SqlServerServerResource

The resource builder.

Returns a handle; failures surface later via Err().

methodWithDataVolumebuilder
Adds a named volume for the data folder to a SQL Server resource.
WithDataVolume(options ...*WithDataVolumeOptions) SqlServerServerResource
options...*WithDataVolumeOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithDataVolumeOptions argument.

Name*stringThe name of the volume. Defaults to an auto-generated name based on the application and resource names.
IsReadOnly*boolA flag that indicates if this is a read-only volume.
SqlServerServerResource

The resource builder.

Returns a handle; failures surface later via Err().

methodWithHostPortbuilder
Configures the host port that the SqlServer resource is exposed on instead of using randomly assigned port.
WithHostPort(port *float64) SqlServerServerResource
port*float64The port to bind on the host. If null is used random port will be assigned.
SqlServerServerResource

The resource builder.

Returns a handle; failures surface later via Err().

methodWithPasswordbuilder
Configures the password that the SqlServer resource is used.
WithPassword(password ParameterResource) SqlServerServerResource
passwordParameterResourceThe parameter used to provide the password for the SqlServer resource.
SqlServerServerResource

The resource builder.

Returns a handle; failures surface later via Err().

methodWithReplbuilder
Adds a REPL command that opens an authenticated SQL Server shell with the configured client tools.
WithRepl(options ...*WithReplOptions) SqlServerServerResource
options...*WithReplOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithReplOptions argument.

Configurefunc(obj SqlServerReplOptions)callbackAn optional callback to configure the SQL Server REPL.
SqlServerServerResource

The resource builder for chaining.

Returns a handle; failures surface later via Err().