IConfiguration 接口

定义

表示一组键/值应用程序配置属性。Represents a set of key/value application configuration properties.

public interface class IConfiguration
public interface IConfiguration
type IConfiguration = interface
Public Interface IConfiguration
派生

属性

Item[String]

获取或设置配置值。Gets or sets a configuration value.

方法

GetChildren()

获取直接后代配置子节。Gets the immediate descendant configuration sub-sections.

GetReloadToken()

返回一个可用于在重载此配置时进行观察的 IChangeTokenReturns a IChangeToken that can be used to observe when this configuration is reloaded.

GetSection(String)

获取具有指定键的配置子节。Gets a configuration sub-section with the specified key.

扩展方法

Bind(IConfiguration, Object)

尝试通过按递归方式根据配置键匹配属性名称,将给定的对象实例绑定到配置值。Attempts to bind the given object instance to configuration values by matching property names against configuration keys recursively.

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

尝试将配置实例绑定到类型为 T 的新实例。如果此配置节包含一个值,则将使用该值。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, Action<BinderOptions>)

尝试将配置实例绑定到类型为 T 的新实例。如果此配置节包含一个值,则将使用该值。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)

尝试将配置实例绑定到类型为 T 的新实例。如果此配置节包含一个值,则将使用该值。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>)

尝试将配置实例绑定到类型为 T 的新实例。如果此配置节包含一个值,则将使用该值。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.

GetValue(IConfiguration, Type, String)

提取具有指定键的值,并将其转换为指定的类型。Extracts the value with the specified key and converts it to the specified type.

GetValue(IConfiguration, Type, String, Object)

提取具有指定键的值,并将其转换为指定的类型。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, T)

提取具有指定键的值,并将其转换为 T 类型。Extracts the value with the specified key and converts it to type T.

AsEnumerable(IConfiguration)

获取 IConfiguration 中的键值对的枚举Get the enumeration of key value pairs within the IConfiguration

AsEnumerable(IConfiguration, Boolean)

获取 IConfiguration 中的键值对的枚举Get the enumeration of key value pairs within the IConfiguration

GetConnectionString(IConfiguration, String)

GetSection("ConnectionStrings")[name] 的简写形式。Shorthand for GetSection("ConnectionStrings")[name].

适用于