ExecutionConfigurationBuilder Methods
ClassMethods3 members
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. AddExecutionConfigurationGatherer(IExecutionConfigurationGatherer)Section titled AddExecutionConfigurationGatherer(IExecutionConfigurationGatherer)IExecutionConfigurationBuilder Adds a configuration gatherer to the builder.
public sealed class ExecutionConfigurationBuilder{ public IExecutionConfigurationBuilder AddExecutionConfigurationGatherer( IExecutionConfigurationGatherer gatherer) { // ... }}Parameters
gathererIExecutionConfigurationGathererThe configuration gatherer to add.Returns
IExecutionConfigurationBuilderThe current instance of the builder.BuildAsync(DistributedApplicationExecutionContext, ILogger?, CancellationToken)Section titled BuildAsync(DistributedApplicationExecutionContext, ILogger?, CancellationToken)Task<IExecutionConfigurationResult> Builds the processed resource configuration (resolved arguments and environment variables).
public sealed class ExecutionConfigurationBuilder{ public Task<IExecutionConfigurationResult> BuildAsync( DistributedApplicationExecutionContext executionContext, ILogger? resourceLogger = null, CancellationToken cancellationToken = default(CancellationToken)) { // ... }}Parameters
executionContextDistributedApplicationExecutionContextThe distributed application execution context.resourceLoggerILogger?optionalA logger instance for the resource. If none is provided, a default logger will be used.cancellationTokenCancellationTokenoptionalA cancellation token.Returns
Task<IExecutionConfigurationResult>The resource configuration result. Any exceptions that occurred while processing are available via the IExecutionConfigurationResult.Exception property. Creates a new instance of
IExecutionConfigurationBuilder. public sealed class ExecutionConfigurationBuilder{ public static IExecutionConfigurationBuilder Create( IResource resource) { // ... }}Parameters
resourceIResourceThe resource to build the configuration for.Remarks
This method is useful for building resource execution configurations (command line arguments and environment variables) in a fluent manner. Individual configuration sources can be added to the builder before finalizing the configuration to allow only supported configuration sources to be applied in a given execution context (run vs. publish, etc).
In particular, this is used to allow certificate-related features to contribute to the final config, but only in execution contexts where they're supported.
var resolvedConfiguration = await ExecutionConfigurationBuilder .Create(myResource) .WithArgumentsConfig() .WithEnvironmentVariablesConfig() .BuildAsync(executionContext) .ConfigureAwait(false);
foreach (var argument in resolvedConfiguration.Arguments){ Console.WriteLine($"Argument: {argument.Value}");}