EnvironmentVariablesExtensions.AddEnvironmentVariables 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
AddEnvironmentVariables(IConfigurationBuilder)
新增從環境變數讀取組態值的 IConfigurationProvider。
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::Configuration::IConfigurationBuilder ^ AddEnvironmentVariables(Microsoft::Extensions::Configuration::IConfigurationBuilder ^ configurationBuilder);
public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddEnvironmentVariables (this Microsoft.Extensions.Configuration.IConfigurationBuilder configurationBuilder);
static member AddEnvironmentVariables : Microsoft.Extensions.Configuration.IConfigurationBuilder -> Microsoft.Extensions.Configuration.IConfigurationBuilder
<Extension()>
Public Function AddEnvironmentVariables (configurationBuilder As IConfigurationBuilder) As IConfigurationBuilder
參數
- configurationBuilder
- IConfigurationBuilder
要新增的目標 IConfigurationBuilder。
傳回
適用於
AddEnvironmentVariables(IConfigurationBuilder, Action<EnvironmentVariablesConfigurationSource>)
新增從環境變數讀取組態值的 IConfigurationProvider。
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::Configuration::IConfigurationBuilder ^ AddEnvironmentVariables(Microsoft::Extensions::Configuration::IConfigurationBuilder ^ builder, Action<Microsoft::Extensions::Configuration::EnvironmentVariables::EnvironmentVariablesConfigurationSource ^> ^ configureSource);
public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddEnvironmentVariables (this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, Action<Microsoft.Extensions.Configuration.EnvironmentVariables.EnvironmentVariablesConfigurationSource>? configureSource);
static member AddEnvironmentVariables : Microsoft.Extensions.Configuration.IConfigurationBuilder * Action<Microsoft.Extensions.Configuration.EnvironmentVariables.EnvironmentVariablesConfigurationSource> -> Microsoft.Extensions.Configuration.IConfigurationBuilder
<Extension()>
Public Function AddEnvironmentVariables (builder As IConfigurationBuilder, configureSource As Action(Of EnvironmentVariablesConfigurationSource)) As IConfigurationBuilder
參數
- builder
- IConfigurationBuilder
要新增的目標 IConfigurationBuilder。
- configureSource
- Action<EnvironmentVariablesConfigurationSource>
設定來源。
傳回
適用於
AddEnvironmentVariables(IConfigurationBuilder, String)
新增 IConfigurationProvider 來從具有指定前置詞的環境變數中讀取組態值。
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::Configuration::IConfigurationBuilder ^ AddEnvironmentVariables(Microsoft::Extensions::Configuration::IConfigurationBuilder ^ configurationBuilder, System::String ^ prefix);
public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddEnvironmentVariables (this Microsoft.Extensions.Configuration.IConfigurationBuilder configurationBuilder, string? prefix);
static member AddEnvironmentVariables : Microsoft.Extensions.Configuration.IConfigurationBuilder * string -> Microsoft.Extensions.Configuration.IConfigurationBuilder
<Extension()>
Public Function AddEnvironmentVariables (configurationBuilder As IConfigurationBuilder, prefix As String) As IConfigurationBuilder
參數
- configurationBuilder
- IConfigurationBuilder
要新增的目標 IConfigurationBuilder。
- prefix
- String
環境變數名稱必須以其為開頭的前置詞。 前置詞將會從環境變數名稱中移除。