Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
ConfigurationManager Class
Definition
- Namespace:
- Microsoft.Extensions.Configuration
- Assembly:
- Microsoft.Extensions.Configuration.dll
- Package:
- Microsoft.Extensions.Configuration v11.0.0-preview.5.26302.115
- Source:
- ConfigurationManager.cs
- Source:
- ConfigurationManager.cs
- Source:
- ConfigurationManager.cs
- Source:
- ConfigurationManager.cs
Important
Some information relates to prerelease product that may be substantially modified before itβs released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a mutable configuration object.
public ref class ConfigurationManager sealed : IDisposable, Microsoft::Extensions::Configuration::IConfigurationManager, Microsoft::Extensions::Configuration::IConfigurationRoot
public sealed class ConfigurationManager : IDisposable, Microsoft.Extensions.Configuration.IConfigurationManager, Microsoft.Extensions.Configuration.IConfigurationRoot
type ConfigurationManager = class
interface IConfigurationManager
interface IConfiguration
interface IConfigurationBuilder
interface IConfigurationRoot
interface IDisposable
Public NotInheritable Class ConfigurationManager
Implements IConfigurationManager, IConfigurationRoot, IDisposable
- Inheritance
-
ConfigurationManager
- Implements
Remarks
It is both an IConfigurationBuilder and an IConfigurationRoot. As sources are added, it updates its current view of configuration.
Constructors
| Name | Description |
|---|---|
| ConfigurationManager() |
Creates an empty mutable configuration object that is both an IConfigurationBuilder and an IConfigurationRoot. |
Properties
| Name | Description |
|---|---|
| Item[String] |
Gets or sets a configuration value. |
| Sources |
Gets the sources used to obtain configuration values. |
Methods
| Name | Description |
|---|---|
| Dispose() |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
| GetChildren() |
Gets the immediate descendant configuration subsections. |
| GetSection(String) |
Gets a configuration subsection with the specified key. |
Explicit Interface Implementations
| Name | Description |
|---|---|
| IConfiguration.GetReloadToken() |
Returns a IChangeToken that can be used to observe when this configuration is reloaded. |
| IConfigurationBuilder.Add(IConfigurationSource) |
Adds a new configuration source. |
| IConfigurationBuilder.Build() |
Builds an IConfiguration with keys and values from the set of sources registered in Sources. |
| IConfigurationBuilder.Properties |
Gets a key-value collection that can be used to share data between the IConfigurationBuilder and the registered configuration sources. |
| IConfigurationRoot.Providers |
Gets the configuration providers for this configuration. |
| IConfigurationRoot.Reload() |
Forces the configuration values to be reloaded from the underlying IConfigurationProvider instances. |
Extension Methods
| Name | Description |
|---|---|
| Add<TSource>(IConfigurationBuilder, Action<TSource>) |
Adds a new configuration source. |
| AddApplicationMetadata(IConfigurationBuilder, IHostEnvironment, String) |
Registers a configuration provider for application metadata. |
| AddCommandLine(IConfigurationBuilder, Action<CommandLineConfigurationSource>) |
Adds an IConfigurationProvider that reads configuration values from the command line. |
| AddCommandLine(IConfigurationBuilder, String[], IDictionary<String,String>) |
Adds a CommandLineConfigurationProviderIConfigurationProvider that reads configuration values from the command line using the specified switch mappings. |
| AddCommandLine(IConfigurationBuilder, String[]) |
Adds a CommandLineConfigurationProviderIConfigurationProvider that reads configuration values from the command line. |
| AddConfiguration(IConfigurationBuilder, IConfiguration, Boolean) |
Adds an existing configuration to |
| AddConfiguration(IConfigurationBuilder, IConfiguration) |
Adds an existing configuration to |
| AddEnvironmentVariables(IConfigurationBuilder, Action<EnvironmentVariablesConfigurationSource>) |
Adds an IConfigurationProvider that reads configuration values from environment variables. |
| AddEnvironmentVariables(IConfigurationBuilder, String) |
Adds an IConfigurationProvider that reads configuration values from environment variables with a specified prefix. |
| AddEnvironmentVariables(IConfigurationBuilder) |
Adds an IConfigurationProvider that reads configuration values from environment variables. |
| AddIniFile(IConfigurationBuilder, Action<IniConfigurationSource>) |
Adds a INI configuration source to |
| AddIniFile(IConfigurationBuilder, IFileProvider, String, Boolean, Boolean) |
Adds a INI configuration source to |
| AddIniFile(IConfigurationBuilder, String, Boolean, Boolean) |
Adds the INI configuration provider at |
| AddIniFile(IConfigurationBuilder, String, Boolean) |
Adds the INI configuration provider at |
| AddIniFile(IConfigurationBuilder, String) |
Adds the INI configuration provider at |
| AddIniStream(IConfigurationBuilder, Stream) |
Adds a INI configuration source to |
| AddInMemoryCollection(IConfigurationBuilder, IEnumerable<KeyValuePair<String,String>>) |
Adds the memory configuration provider to |
| AddInMemoryCollection(IConfigurationBuilder) |
Adds the memory configuration provider to |
| AddJsonFile(IConfigurationBuilder, Action<JsonConfigurationSource>) |
Adds a JSON configuration source to |
| AddJsonFile(IConfigurationBuilder, IFileProvider, String, Boolean, Boolean) |
Adds a JSON configuration source to |
| AddJsonFile(IConfigurationBuilder, String, Boolean, Boolean) |
Adds the JSON configuration provider at |
| AddJsonFile(IConfigurationBuilder, String, Boolean) |
Adds the JSON configuration provider at |
| AddJsonFile(IConfigurationBuilder, String) |
Adds the JSON configuration provider at |
| AddJsonStream(IConfigurationBuilder, Stream) |
Adds a JSON configuration source to |
| AddKeyPerFile(IConfigurationBuilder, Action<KeyPerFileConfigurationSource>) |
Adds configuration using files from a directory. File names are used as the key, file contents are used as the value. |
| AddKeyPerFile(IConfigurationBuilder, String, Boolean, Boolean) |
Adds configuration using files from a directory. File names are used as the key, file contents are used as the value. |
| AddKeyPerFile(IConfigurationBuilder, String, Boolean) |
Adds configuration using files from a directory. File names are used as the key, file contents are used as the value. |
| AddKeyPerFile(IConfigurationBuilder, String) |
Adds configuration using files from a directory. File names are used as the key, file contents are used as the value. |
| AddUserSecrets(IConfigurationBuilder, Assembly, Boolean, Boolean) |
Adds the user secrets configuration source. This searches A user secrets ID is unique value used to store and identify a collection of secret configuration values. |
| AddUserSecrets(IConfigurationBuilder, Assembly, Boolean) |
Adds the user secrets configuration source. This searches A user secrets ID is unique value used to store and identify a collection of secret configuration values. |
| AddUserSecrets(IConfigurationBuilder, Assembly) |
Adds the user secrets configuration source. This searches A user secrets ID is unique value used to store and identify a collection of secret configuration values. |
| AddUserSecrets(IConfigurationBuilder, String, Boolean) |
Adds the user secrets configuration source with specified user secrets ID. A user secrets ID is unique value used to store and identify a collection of secret configuration values. |
| AddUserSecrets(IConfigurationBuilder, String) |
Adds the user secrets configuration source with specified user secrets ID. A user secrets ID is unique value used to store and identify a collection of secret configuration values. |
| AddUserSecrets<T>(IConfigurationBuilder, Boolean, Boolean) |
Adds the user secrets configuration source. Searches the assembly that contains type A user secrets ID is unique value used to store and identify a collection of secret configuration values. |
| AddUserSecrets<T>(IConfigurationBuilder, Boolean) |
Adds the user secrets configuration source. Searches the assembly that contains type A user secrets ID is unique value used to store and identify a collection of secret configuration values. |
| AddUserSecrets<T>(IConfigurationBuilder) |
Adds the user secrets configuration source. Searches the assembly that contains type A user secrets ID is unique value used to store and identify a collection of secret configuration values. |
| AddXmlFile(IConfigurationBuilder, Action<XmlConfigurationSource>) |
Adds an XML configuration source to |
| AddXmlFile(IConfigurationBuilder, IFileProvider, String, Boolean, Boolean) |
Adds an XML configuration source to |
| AddXmlFile(IConfigurationBuilder, String, Boolean, Boolean) |
Adds the XML configuration provider at |
| AddXmlFile(IConfigurationBuilder, String, Boolean) |
Adds the XML configuration provider at |
| AddXmlFile(IConfigurationBuilder, String) |
Adds the XML configuration provider at |
| AddXmlStream(IConfigurationBuilder, Stream) |
Adds an XML configuration source to |
| AsEnumerable(IConfiguration, Boolean) |
Get the enumeration of key value pairs within the IConfiguration |
| AsEnumerable(IConfiguration) |
Get the enumeration of key value pairs within the IConfiguration |
| Bind(IConfiguration, Object, Action<BinderOptions>) |
Attempts to bind the given object instance to configuration values by matching property names against configuration keys recursively. |
| Bind(IConfiguration, Object) |
Attempts to bind the given object instance to configuration values by matching property names against configuration keys recursively. |
| Bind(IConfiguration, String, Object) |
Attempts to bind the given object instance to the configuration section specified by the key by matching property names against configuration keys recursively. |
| Get(IConfiguration, Type, Action<BinderOptions>) |
Attempts to bind the configuration instance to a new instance of type T. If this configuration section has a value, that will be used. Otherwise binding by matching property names against configuration keys recursively. |
| Get(IConfiguration, Type) |
Attempts to bind the configuration instance to a new instance of type T. If this configuration section has a value, that will be used. Otherwise binding by matching property names against configuration keys recursively. |
| Get<T>(IConfiguration, Action<BinderOptions>) |
Attempts to bind the configuration instance to a new instance of type T. If this configuration section has a value, that will be used. Otherwise binding by matching property names against configuration keys recursively. |
| Get<T>(IConfiguration) |
Attempts to bind the configuration instance to a new instance of type T. If this configuration section has a value, that will be used. Otherwise binding by matching property names against configuration keys recursively. |
| GetConnectionString(IConfiguration, String) |
Gets the specified connection string from the specified configuration.
Shorthand for |
| GetDebugView(IConfigurationRoot, Func<ConfigurationDebugViewContext,String>) |
Generates a human-readable view of the configuration showing where each value came from. |
| GetDebugView(IConfigurationRoot) |
Generates a human-readable view of the configuration showing where each value came from. |
| GetFileLoadExceptionHandler(IConfigurationBuilder) |
Gets a default action to be invoked for file-based providers when an error occurs. |
| GetFileProvider(IConfigurationBuilder) |
Gets the default IFileProvider to be used for file-based providers. |
| GetRequiredSection(IConfiguration, String) |
Gets a configuration subsection with the specified key. |
| GetValue(IConfiguration, Type, String, Object) |
Extracts the value with the specified key and converts it to the specified type. |
| GetValue(IConfiguration, Type, String) |
Extracts the value with the specified key and converts it to the specified type. |
| GetValue<T>(IConfiguration, String, T) |
Extracts the value with the specified key and converts it to type T. |
| GetValue<T>(IConfiguration, String) |
Extracts the value with the specified key and converts it to type T. |
| SetBasePath(IConfigurationBuilder, String) |
Sets the FileProvider for file-based providers to a PhysicalFileProvider with the base path. |
| SetFileLoadExceptionHandler(IConfigurationBuilder, Action<FileLoadExceptionContext>) |
Sets a default action to be invoked for file-based providers when an error occurs. |
| SetFileProvider(IConfigurationBuilder, IFileProvider) |
Sets the default IFileProvider to be used for file-based providers. |
Applies to
Feedback
Was this page helpful?
