EnvironmentVariablesExtensions.AddEnvironmentVariables 方法

定义

重载

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)

添加从具有指定前缀的环境变量读取配置值的 IConfigurationProviderAdds an IConfigurationProvider that reads configuration values from environment variables with a specified prefix.

AddEnvironmentVariables(IConfigurationBuilder)

添加从环境变量读取配置值的 IConfigurationProviderAdds an IConfigurationProvider that reads configuration values from environment variables.

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

要添加到的 IConfigurationBuilderThe IConfigurationBuilder to add to.

返回

IConfigurationBuilder

IConfigurationBuilderThe IConfigurationBuilder.

适用于

AddEnvironmentVariables(IConfigurationBuilder, Action<EnvironmentVariablesConfigurationSource>)

添加从环境变量读取配置值的 IConfigurationProviderAdds an IConfigurationProvider that reads configuration values from environment variables.

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

要添加到的 IConfigurationBuilderThe IConfigurationBuilder to add to.

configureSource
Action<EnvironmentVariablesConfigurationSource>

配置源。Configures the source.

返回

IConfigurationBuilder

IConfigurationBuilderThe IConfigurationBuilder.

适用于

AddEnvironmentVariables(IConfigurationBuilder, String)

添加从具有指定前缀的环境变量读取配置值的 IConfigurationProviderAdds an IConfigurationProvider that reads configuration values from environment variables with a specified prefix.

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

要添加到的 IConfigurationBuilderThe IConfigurationBuilder to add to.

prefix
String

环境变量名称必须以其开头的前缀。The prefix that environment variable names must start with. 将从环境变量名称中删除该前缀。The prefix will be removed from the environment variable names.

返回

IConfigurationBuilder

IConfigurationBuilderThe IConfigurationBuilder.

适用于