Table of Contents

Method ConfigureAppConfiguration

Namespace
Ploch.CommandLine.Spectre
Assembly
Ploch.CommandLine.Spectre.dll

ConfigureAppConfiguration(Action<IConfigurationBuilder>)

Configures the application's configuration using the specified delegate.

[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "This method is a part of the public API and is intended for use by consumers of the AppBuilder class.")]
public AppBuilder ConfigureAppConfiguration(Action<IConfigurationBuilder> appConfigurationConfigurator)

Parameters

appConfigurationConfigurator Action<IConfigurationBuilder>

A delegate that provides access to the IConfigurationBuilder for configuring the application's configuration.

Returns

AppBuilder

The current instance of AppBuilder for method chaining.

Remarks

This method simplifies the customisation of the application's configuration by allowing direct access to the IConfigurationBuilder. It can be used to add configuration sources, modify existing configurations, or apply specific settings without requiring access to the hosting context.

Calls accumulate: every delegate passed to either overload is applied, in the order it was added, matching the additive behaviour of ConfigureAppConfiguration(Action<HostBuilderContext, IConfigurationBuilder>). The order is shared with ConfigureHost(Action<IHostBuilder>), so a source added here takes precedence over one added by an earlier ConfigureHost(Action<IHostBuilder>) call and yields to one added by a later call. See ConfigureCommandApp(Action<IConfigurator>) for the full ordering guarantee.

Exceptions

ArgumentNullException

Thrown when appConfigurationConfigurator is null.

ConfigureAppConfiguration(Action<HostBuilderContext, IConfigurationBuilder>)

Configures the application's configuration using the specified delegate.

[SuppressMessage("ReSharper", "MemberCanBePrivate.Global", Justification = "This method is a part of the public API and is intended for use by consumers of the AppBuilder class.")]
public AppBuilder ConfigureAppConfiguration(Action<HostBuilderContext, IConfigurationBuilder> appConfigurationConfigurator)

Parameters

appConfigurationConfigurator Action<HostBuilderContext, IConfigurationBuilder>

A delegate that provides access to the HostBuilderContext and IConfigurationBuilder for configuring the application's configuration.

Returns

AppBuilder

The current instance of AppBuilder for method chaining.

Remarks

This method allows for advanced customisation of the application's configuration by enabling the use of both the hosting context and the configuration builder. It can be used to add configuration sources, modify existing configurations, or apply environment-specific settings.

Calls accumulate: every delegate passed to either overload is applied, in the order it was added, matching the additive behaviour of ConfigureAppConfiguration(Action<HostBuilderContext, IConfigurationBuilder>). The order is shared with ConfigureHost(Action<IHostBuilder>), so a source added here takes precedence over one added by an earlier ConfigureHost(Action<IHostBuilder>) call and yields to one added by a later call. See ConfigureCommandApp(Action<IConfigurator>) for the full ordering guarantee.

Exceptions

ArgumentNullException

Thrown when appConfigurationConfigurator is null.