次の方法で共有


ExecutionConfigurationBuilder Class

Definition

Provides a builder for constructing an IExecutionConfigurationResult for a specific resource in the distributed application model. This resolves command line arguments and environment variables and potentially additional metadata through registered gatherers.

public sealed class ExecutionConfigurationBuilder : Aspire.Hosting.ApplicationModel.IExecutionConfigurationBuilder
type ExecutionConfigurationBuilder = class
    interface IExecutionConfigurationBuilder
Public NotInheritable Class ExecutionConfigurationBuilder
Implements IExecutionConfigurationBuilder
Inheritance
ExecutionConfigurationBuilder
Implements

Examples

var resolvedConfiguration = await ExecutionConfigurationBuilder
    .Create(myResource);
    .WithArgumentsConfig()
    .WithEnvironmentVariablesConfig()
    .BuildAsync(executionContext).ConfigureAwait(false);

Remarks

Use ExecutionConfigurationBuilder when you need to programmatically assemble configuration for a resource, typically by aggregating multiple configuration sources using the gatherer pattern. This builder collects configuration from registered IExecutionConfigurationGatherer instances, which encapsulate logic for gathering resource-specific command line arguments, environment variables, and other metadata.

The gatherer pattern allows for modular and extensible configuration assembly, where each gatherer can contribute part of the final configuration and allows for collecting only the relevant configuration supported in a given context (i.e. only applying certificate configuration gatherers in supported environments).

Typical usage involves creating a builder for a resource, adding one or more configuration gatherers, and then building the configuration asynchronously.

Methods

Name Description
AddExecutionConfigurationGatherer(IExecutionConfigurationGatherer)

Adds a configuration gatherer to the builder.

BuildAsync(DistributedApplicationExecutionContext, ILogger, CancellationToken)

Builds the processed resource configuration (resolved arguments and environment variables).

Create(IResource)

Creates a new instance of IExecutionConfigurationBuilder.

Extension Methods

Name Description
WithArgumentsConfig(IExecutionConfigurationBuilder)

Adds a command line arguments configuration gatherer to the builder.

WithCertificateTrustConfig(IExecutionConfigurationBuilder, Func<CertificateTrustScope,CertificateTrustExecutionConfigurationContext>)

Adds a certificate trust configuration gatherer to the builder.

WithEnvironmentVariablesConfig(IExecutionConfigurationBuilder)

Adds an environment variables configuration gatherer to the builder.

WithHttpsCertificateConfig(IExecutionConfigurationBuilder, Func<X509Certificate2,HttpsCertificateExecutionConfigurationContext>)

Adds a server authentication certificate configuration gatherer to the builder.

Applies to