共用方式為


ParameterResourceBuilderExtensions.AddParameter Method

Definition

Overloads

AddParameter(IDistributedApplicationBuilder, String, Boolean)

Adds a parameter resource to the application.

AddParameter(IDistributedApplicationBuilder, String, ParameterDefault, Boolean, Boolean)

Adds a parameter resource to the application, with a value coming from a ParameterDefault.

AddParameter(IDistributedApplicationBuilder, String, Func<String>, Boolean, Boolean)

Adds a parameter resource to the application with a value coming from a callback function.

AddParameter(IDistributedApplicationBuilder, String, String, Boolean, Boolean)

Adds a parameter resource to the application with a given value.

AddParameter(IDistributedApplicationBuilder, String, Boolean)

Source:
ParameterResourceBuilderExtensions.cs
Source:
ParameterResourceBuilderExtensions.cs

Adds a parameter resource to the application.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource> AddParameter (this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, bool secret = false);
static member AddParameter : Aspire.Hosting.IDistributedApplicationBuilder * string * bool -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>
<Extension()>
Public Function AddParameter (builder As IDistributedApplicationBuilder, name As String, Optional secret As Boolean = false) As IResourceBuilder(Of ParameterResource)

Parameters

builder
IDistributedApplicationBuilder

Distributed application builder

name
String

Name of parameter resource

secret
Boolean

Optional flag indicating whether the parameter should be regarded as secret.

Returns

Resource builder for the parameter.

Exceptions

Applies to

AddParameter(IDistributedApplicationBuilder, String, ParameterDefault, Boolean, Boolean)

Source:
ParameterResourceBuilderExtensions.cs

Adds a parameter resource to the application, with a value coming from a ParameterDefault.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource> AddParameter (this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, Aspire.Hosting.ApplicationModel.ParameterDefault value, bool secret = false, bool persist = false);
static member AddParameter : Aspire.Hosting.IDistributedApplicationBuilder * string * Aspire.Hosting.ApplicationModel.ParameterDefault * bool * bool -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>
<Extension()>
Public Function AddParameter (builder As IDistributedApplicationBuilder, name As String, value As ParameterDefault, Optional secret As Boolean = false, Optional persist As Boolean = false) As IResourceBuilder(Of ParameterResource)

Parameters

builder
IDistributedApplicationBuilder

Distributed application builder

name
String

Name of parameter resource

value
ParameterDefault

A ParameterDefault that is used to provide the parameter value

secret
Boolean

Optional flag indicating whether the parameter should be regarded as secret.

persist
Boolean

Persist the value to the app host project's user secrets store. This is typically done when the value is generated, so that it stays stable across runs. This is only relevant when IsRunMode is true

Returns

Resource builder for the parameter.

Applies to

AddParameter(IDistributedApplicationBuilder, String, Func<String>, Boolean, Boolean)

Source:
ParameterResourceBuilderExtensions.cs

Adds a parameter resource to the application with a value coming from a callback function.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource> AddParameter (this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, Func<string> valueGetter, bool publishValueAsDefault = false, bool secret = false);
static member AddParameter : Aspire.Hosting.IDistributedApplicationBuilder * string * Func<string> * bool * bool -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>
<Extension()>
Public Function AddParameter (builder As IDistributedApplicationBuilder, name As String, valueGetter As Func(Of String), Optional publishValueAsDefault As Boolean = false, Optional secret As Boolean = false) As IResourceBuilder(Of ParameterResource)

Parameters

builder
IDistributedApplicationBuilder

Distributed application builder

name
String

Name of parameter resource

valueGetter
Func<String>

A callback function that returns the value of the parameter

publishValueAsDefault
Boolean

Indicates whether the value should be published to the manifest. This is not meant for sensitive data.

secret
Boolean

Optional flag indicating whether the parameter should be regarded as secret.

Returns

Resource builder for the parameter.

Remarks

publishValueAsDefault and secret are mutually exclusive.

Applies to

AddParameter(IDistributedApplicationBuilder, String, String, Boolean, Boolean)

Source:
ParameterResourceBuilderExtensions.cs

Adds a parameter resource to the application with a given value.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource> AddParameter (this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, string value, bool publishValueAsDefault = false, bool secret = false);
static member AddParameter : Aspire.Hosting.IDistributedApplicationBuilder * string * string * bool * bool -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>
<Extension()>
Public Function AddParameter (builder As IDistributedApplicationBuilder, name As String, value As String, Optional publishValueAsDefault As Boolean = false, Optional secret As Boolean = false) As IResourceBuilder(Of ParameterResource)

Parameters

builder
IDistributedApplicationBuilder

Distributed application builder

name
String

Name of parameter resource

value
String

A string value to use for the parameter

publishValueAsDefault
Boolean

Indicates whether the value should be published to the manifest. This is not meant for sensitive data.

secret
Boolean

Optional flag indicating whether the parameter should be regarded as secret.

Returns

Resource builder for the parameter.

Remarks

publishValueAsDefault and secret are mutually exclusive.

Applies to