共用方式為


MySqlBuilderExtensions.AddMySql Method

Definition

Adds a MySQL server resource to the application model. For local development a container is used.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.MySqlServerResource> AddMySql (this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>? password = default, int? port = default);
static member AddMySql : Aspire.Hosting.IDistributedApplicationBuilder * string * Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource> * Nullable<int> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.MySqlServerResource>
<Extension()>
Public Function AddMySql (builder As IDistributedApplicationBuilder, name As String, Optional password As IResourceBuilder(Of ParameterResource) = Nothing, Optional port As Nullable(Of Integer) = Nothing) As IResourceBuilder(Of MySqlServerResource)

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 root password for the MySQL resource. If null a random password will be generated.

port
Nullable<Int32>

The host port for MySQL.

Returns

A reference to the IResourceBuilder<T>.

Remarks

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

Applies to