ExecutionConfigurationBuilder Methods
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)Ipublic sealed class ExecutionConfigurationBuilder{ public IExecutionConfigurationBuilder AddExecutionConfigurationGatherer( IExecutionConfigurationGatherer gatherer) { // ... }}Parameters
gathererIReturns
IExecutionConfigurationBuilder The current instance of the builder.BuildAsync(DistributedApplicationExecutionContext, ILogger?, CancellationToken) Section titled BuildAsync(DistributedApplicationExecutionContext, ILogger?, CancellationToken)Taskpublic sealed class ExecutionConfigurationBuilder{ public Task<IExecutionConfigurationResult> BuildAsync( DistributedApplicationExecutionContext executionContext, ILogger? resourceLogger = null, CancellationToken cancellationToken = default(CancellationToken)) { // ... }}Parameters
executionContext DistributedresourceLogger ILogger? optionalA logger instance for the resource. If none is provided, a default logger will be used.cancellationToken CancellationToken optionalA cancellation token.Returns
Task<IExecutionConfigurationResult> The resource configuration result. Any exceptions that occurred while processing are available via the IExecutionConfigurationResult.Exception property.IExecutionConfigurationBuilder . public sealed class ExecutionConfigurationBuilder{ public static IExecutionConfigurationBuilder Create( IResource resource) { // ... }}Parameters
resourceIRemarks
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}");}