EnvironmentVariablesExtensions.AddEnvironmentVariables 方法

定义

重载

AddEnvironmentVariables(IConfigurationBuilder)

添加从环境变量读取配置值的 IConfigurationProvider

AddEnvironmentVariables(IConfigurationBuilder, Action<EnvironmentVariablesConfigurationSource>)

添加从环境变量读取配置值的 IConfigurationProvider

AddEnvironmentVariables(IConfigurationBuilder, String)

添加从具有指定前缀的环境变量读取配置值的 IConfigurationProvider

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

返回

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);
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>

配置源。

返回

IConfigurationBuilder

IConfigurationBuilder

适用于

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);
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

环境变量名称必须以其开头的前缀。 将从环境变量名称中删除该前缀。

返回

IConfigurationBuilder

IConfigurationBuilder

适用于