ConfigurationBuilder Class

Definition

用於建立要在應用程式中使用的索引鍵/值型組態。Used to build key/value based configuration settings for use in an application.

public ref class ConfigurationBuilder : Microsoft::Extensions::Configuration::IConfigurationBuilder
public class ConfigurationBuilder : Microsoft.Extensions.Configuration.IConfigurationBuilder
type ConfigurationBuilder = class
    interface IConfigurationBuilder
Public Class ConfigurationBuilder
Implements IConfigurationBuilder
Inheritance
ConfigurationBuilder
Implements

Constructors

ConfigurationBuilder()

Properties

Properties

取得索引鍵/值集合,可用於在 IConfigurationBuilder 與已註冊的 IConfigurationProvider 之間共用資料。Gets a key/value collection that can be used to share data between the IConfigurationBuilder and the registered IConfigurationProviders.

Sources

傳回用於取得組態值的來源。Returns the sources used to obtain configuration values.

Methods

Add(IConfigurationSource)

新增組態來源。Adds a new configuration source.

Build()

建置 IConfiguration,其中包含在 Sources 中註冊的提供者集合索引鍵和值。Builds an IConfiguration with keys and values from the set of providers registered in Sources.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

Extension Methods

AddAzureKeyVault(IConfigurationBuilder, AzureKeyVaultConfigurationOptions)

新增可從 Azure KeyVault 讀取組態值的 IConfigurationProviderAdds an IConfigurationProvider that reads configuration values from the Azure KeyVault.

AddAzureKeyVault(IConfigurationBuilder, String)

新增可從 Azure KeyVault 讀取組態值的 IConfigurationProviderAdds an IConfigurationProvider that reads configuration values from the Azure KeyVault.

AddAzureKeyVault(IConfigurationBuilder, String, KeyVaultClient, IKeyVaultSecretManager)

新增可從 Azure KeyVault 讀取組態值的 IConfigurationProviderAdds an IConfigurationProvider that reads configuration values from the Azure KeyVault.

AddAzureKeyVault(IConfigurationBuilder, String, IKeyVaultSecretManager)

新增可從 Azure KeyVault 讀取組態值的 IConfigurationProviderAdds an IConfigurationProvider that reads configuration values from the Azure KeyVault.

AddAzureKeyVault(IConfigurationBuilder, String, String, X509Certificate2)

新增可從 Azure KeyVault 讀取組態值的 IConfigurationProviderAdds an IConfigurationProvider that reads configuration values from the Azure KeyVault.

AddAzureKeyVault(IConfigurationBuilder, String, String, X509Certificate2, IKeyVaultSecretManager)

新增可從 Azure KeyVault 讀取組態值的 IConfigurationProviderAdds an IConfigurationProvider that reads configuration values from the Azure KeyVault.

AddAzureKeyVault(IConfigurationBuilder, String, String, String)

新增可從 Azure KeyVault 讀取組態值的 IConfigurationProviderAdds an IConfigurationProvider that reads configuration values from the Azure KeyVault.

AddAzureKeyVault(IConfigurationBuilder, String, String, String, IKeyVaultSecretManager)

新增可從 Azure KeyVault 讀取組態值的 IConfigurationProviderAdds an IConfigurationProvider that reads configuration values from the Azure KeyVault.

AddConfiguration(IConfigurationBuilder, IConfiguration)

將現有組態新增至 configurationBuilderAdds an existing configuration to configurationBuilder.

AddConfiguration(IConfigurationBuilder, IConfiguration, Boolean)

將現有組態新增至 configurationBuilderAdds an existing configuration to configurationBuilder.

AddCommandLine(IConfigurationBuilder, Action<CommandLineConfigurationSource>)

新增從命令列讀取組態值的 IConfigurationProviderAdds an IConfigurationProvider that reads configuration values from the command line.

AddCommandLine(IConfigurationBuilder, String[])

新增從命令列讀取組態值的 CommandLineConfigurationProviderIConfigurationProviderAdds a CommandLineConfigurationProviderIConfigurationProvider that reads configuration values from the command line.

AddCommandLine(IConfigurationBuilder, String[], IDictionary<String,String>)

使用指定的參數對應,新增從命令列讀取設定值的 CommandLineConfigurationProviderIConfigurationProviderAdds a CommandLineConfigurationProviderIConfigurationProvider that reads configuration values from the command line using the specified switch mappings.

Add<TSource>(IConfigurationBuilder, Action<TSource>)

新增組態來源。Adds a new configuration source.

AddUserSecrets(IConfigurationBuilder)

新增使用者祕密組態來源。Adds the user secrets configuration source. GetEntryAssembly() 執行個體的 UserSecretsIdAttribute 中搜尋組件。Searches the assembly from GetEntryAssembly() for an instance of UserSecretsIdAttribute.

AddUserSecrets(IConfigurationBuilder, Assembly)

新增使用者祕密組態來源。Adds the user secrets configuration source.

AddUserSecrets(IConfigurationBuilder, String)

新增具有指定祕密識別碼的使用者祕密組態來源。Adds the user secrets configuration source with specified secrets id.

AddUserSecrets<T>(IConfigurationBuilder)

新增使用者祕密組態來源。Adds the user secrets configuration source. 搜尋包含 T 執行個體之 UserSecretsIdAttribute 類型的組件。Searches the assembly that contains type T for an instance of UserSecretsIdAttribute.

AddEnvironmentVariables(IConfigurationBuilder)

新增從環境變數讀取組態值的 IConfigurationProviderAdds an IConfigurationProvider that reads configuration values from environment variables.

AddEnvironmentVariables(IConfigurationBuilder, Action<EnvironmentVariablesConfigurationSource>)

新增從環境變數讀取組態值的 IConfigurationProviderAdds an IConfigurationProvider that reads configuration values from environment variables.

AddEnvironmentVariables(IConfigurationBuilder, String)

新增 IConfigurationProvider 來從具有指定前置詞的環境變數中讀取組態值。Adds an IConfigurationProvider that reads configuration values from environment variables with a specified prefix.

GetFileLoadExceptionHandler(IConfigurationBuilder)

取得要用於檔案型提供者的預設 IFileProviderGets the default IFileProvider to be used for file-based providers.

GetFileProvider(IConfigurationBuilder)

取得要用於檔案型提供者的預設 IFileProviderGets the default IFileProvider to be used for file-based providers.

SetBasePath(IConfigurationBuilder, String)

將檔案型提供者之 FileProvider 設定為具有基底路徑的 PhysicalFileProvider。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)

設定要用於檔案型提供者的預設 IFileProviderSets the default IFileProvider to be used for file-based providers.

AddIniFile(IConfigurationBuilder, IFileProvider, String, Boolean, Boolean)

將 INI 組態來源新增至 builderAdds a INI configuration source to builder.

AddIniFile(IConfigurationBuilder, Action<IniConfigurationSource>)

將 INI 組態來源新增至 builderAdds a INI configuration source to builder.

AddIniFile(IConfigurationBuilder, String)

path 中將 INI 組態提供者新增至 builderAdds the INI configuration provider at path to builder.

AddIniFile(IConfigurationBuilder, String, Boolean)

path 中將 INI 組態提供者新增至 builderAdds the INI configuration provider at path to builder.

AddIniFile(IConfigurationBuilder, String, Boolean, Boolean)

path 中將 INI 組態提供者新增至 builderAdds the INI configuration provider at path to builder.

AddIniStream(IConfigurationBuilder, Stream)

將 INI 組態來源新增至 builderAdds a INI configuration source to builder.

AddJsonFile(IConfigurationBuilder, IFileProvider, String, Boolean, Boolean)

將 JSON 組態來源新增至 builderAdds a JSON configuration source to builder.

AddJsonFile(IConfigurationBuilder, Action<JsonConfigurationSource>)

將 JSON 組態來源新增至 builderAdds a JSON configuration source to builder.

AddJsonFile(IConfigurationBuilder, String)

path 中將 JSON 組態提供者新增至 builderAdds the JSON configuration provider at path to builder.

AddJsonFile(IConfigurationBuilder, String, Boolean)

path 中將 JSON 組態提供者新增至 builderAdds the JSON configuration provider at path to builder.

AddJsonFile(IConfigurationBuilder, String, Boolean, Boolean)

path 中將 JSON 組態提供者新增至 builderAdds the JSON configuration provider at path to builder.

AddJsonStream(IConfigurationBuilder, Stream)

將 JSON 組態來源新增至 builderAdds a JSON configuration source to builder.

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)

使用目錄中的檔案新增組態。Adds configuration using files from a directory. 檔案名稱會用作索引建,檔案內容會用作值。File names are used as the key, file contents are used as the value.

AddInMemoryCollection(IConfigurationBuilder)

將記憶體組態提供者新增至 configurationBuilderAdds the memory configuration provider to configurationBuilder.

AddInMemoryCollection(IConfigurationBuilder, IEnumerable<KeyValuePair<String,String>>)

將記憶體組態提供者新增至 configurationBuilderAdds the memory configuration provider to configurationBuilder.

AddNewtonsoftJsonFile(IConfigurationBuilder, IFileProvider, String, Boolean, Boolean)

將 JSON 組態來源新增至 builderAdds a JSON configuration source to builder.

AddNewtonsoftJsonFile(IConfigurationBuilder, Action<NewtonsoftJsonConfigurationSource>)

將 JSON 組態來源新增至 builderAdds a JSON configuration source to builder.

AddNewtonsoftJsonFile(IConfigurationBuilder, String)

path 中將 JSON 組態提供者新增至 builderAdds the JSON configuration provider at path to builder.

AddNewtonsoftJsonFile(IConfigurationBuilder, String, Boolean)

path 中將 JSON 組態提供者新增至 builderAdds the JSON configuration provider at path to builder.

AddNewtonsoftJsonFile(IConfigurationBuilder, String, Boolean, Boolean)

path 中將 JSON 組態提供者新增至 builderAdds the JSON configuration provider at path to builder.

AddNewtonsoftJsonStream(IConfigurationBuilder, Stream)

將 Newtonsoft JSON 組態來源新增至 builderAdds a Newtonsoft JSON configuration source to builder.

AddUserSecrets(IConfigurationBuilder, Assembly)

新增使用者祕密組態來源。Adds the user secrets configuration source. 這會搜尋 assembly 執行個體的 UserSecretsIdAttribute,其會指定使用者祕密識別碼。This searches assembly for an instance of UserSecretsIdAttribute, which specifies a user secrets ID.

使用者祕密識別碼是用來儲存及識別祕密組態值集合的唯一值。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. 這會搜尋 assembly 執行個體的 UserSecretsIdAttribute,其會指定使用者祕密識別碼。This searches assembly for an instance of UserSecretsIdAttribute, which specifies a user secrets ID.

使用者祕密識別碼是用來儲存及識別祕密組態值集合的唯一值。A user secrets ID is unique value used to store and identify a collection of secret configuration values.

AddUserSecrets(IConfigurationBuilder, Assembly, Boolean, Boolean)

新增使用者祕密組態來源。Adds the user secrets configuration source. 這會搜尋 assembly 執行個體的 UserSecretsIdAttribute,其會指定使用者祕密識別碼。This searches assembly for an instance of UserSecretsIdAttribute, which specifies a 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(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<T>(IConfigurationBuilder)

新增使用者祕密組態來源。Adds the user secrets configuration source. 搜尋包含類型 T 的組件以取得 UserSecretsIdAttribute 執行個體,其會指定使用者祕密識別碼。Searches the assembly that contains type T for an instance of UserSecretsIdAttribute, which specifies a 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)

新增使用者祕密組態來源。Adds the user secrets configuration source. 搜尋包含類型 T 的組件以取得 UserSecretsIdAttribute 執行個體,其會指定使用者祕密識別碼。Searches the assembly that contains type T for an instance of UserSecretsIdAttribute, which specifies a 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. 搜尋包含類型 T 的組件以取得 UserSecretsIdAttribute 執行個體,其會指定使用者祕密識別碼。Searches the assembly that contains type T for an instance of UserSecretsIdAttribute, which specifies a user secrets ID.

使用者祕密識別碼是用來儲存及識別祕密組態值集合的唯一值。A user secrets ID is unique value used to store and identify a collection of secret configuration values.

AddXmlFile(IConfigurationBuilder, IFileProvider, String, Boolean, Boolean)

將 XML 組態來源新增至 builderAdds a XML configuration source to builder.

AddXmlFile(IConfigurationBuilder, Action<XmlConfigurationSource>)

將 XML 組態來源新增至 builderAdds a XML configuration source to builder.

AddXmlFile(IConfigurationBuilder, String)

path 中將 XML 組態提供者新增至 builderAdds the XML configuration provider at path to builder.

AddXmlFile(IConfigurationBuilder, String, Boolean)

path 中將 XML 組態提供者新增至 builderAdds the XML configuration provider at path to builder.

AddXmlFile(IConfigurationBuilder, String, Boolean, Boolean)

path 中將 XML 組態提供者新增至 builderAdds the XML configuration provider at path to builder.

AddXmlStream(IConfigurationBuilder, Stream)

將 XML 組態來源新增至 builderAdds a XML configuration source to builder.

Applies to