次の方法で共有


ParameterResourceBuilderExtensions.AddConnectionString Method

Definition

Adds a parameter to the distributed application but wrapped in a resource with a connection string for use with WithReference<TDestination>(IResourceBuilder<TDestination>, IResourceBuilder<IResourceWithConnectionString>, String, Boolean)

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.IResourceWithConnectionString> AddConnectionString (this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, string? environmentVariableName = default);
static member AddConnectionString : Aspire.Hosting.IDistributedApplicationBuilder * string * string -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.IResourceWithConnectionString>
<Extension()>
Public Function AddConnectionString (builder As IDistributedApplicationBuilder, name As String, Optional environmentVariableName As String = Nothing) As IResourceBuilder(Of IResourceWithConnectionString)

Parameters

builder
IDistributedApplicationBuilder

Distributed application builder

name
String

Name of parameter resource. The value of the connection string is read from the "ConnectionStrings:{resourcename}" configuration section, for example in appsettings.json or user secrets

environmentVariableName
String

Environment variable name to set when WithReference is used.

Returns

Resource builder for the parameter.

Exceptions

Applies to