Interface ICfgSource
配置源接口,定义了配置源的基本行为
public interface ICfgSource
- Extension Methods
Properties
IsPrimaryWriter
获取是否为主要写入源,用于标识当多个可写源存在时的主要写入目标
bool IsPrimaryWriter { get; }
Property Value
IsWriteable
获取是否可写,指示该配置源是否支持写入操作
bool IsWriteable { get; }
Property Value
KeyCount
获取配置项数量(所有叶子节点的总数)
int KeyCount { get; }
Property Value
Level
获取配置层级,数值越大优先级越高
int Level { get; }
Property Value
Name
获取或设置配置源名称(同一层级内唯一)
string Name { get; set; }
Property Value
TopLevelKeyCount
获取顶级配置键数量(只统计第一层节点)
int TopLevelKeyCount { get; }
Property Value
Type
获取配置源类型名称
string Type { get; }
Property Value
Methods
BuildSource()
构建 Microsoft.Extensions.Configuration 的配置源
IConfigurationSource BuildSource()
Returns
- IConfigurationSource
Microsoft.Extensions.Configuration.IConfigurationSource 实例
GetAllValues()
获取该配置源的所有配置值
IEnumerable<KeyValuePair<string, string?>> GetAllValues()
Returns
- IEnumerable<KeyValuePair<string, string>>
配置键值对集合