Class DependsOnRule
- Namespace
- Apq.Cfg.Validation.Rules
- Assembly
- Apq.Cfg.dll
依赖验证规则 - 当依赖键存在时,当前键也必须存在
public sealed class DependsOnRule : IValidationRule
- Inheritance
-
DependsOnRule
- Implements
- Inherited Members
Constructors
DependsOnRule(string, string, string?)
创建依赖验证规则
public DependsOnRule(string key, string dependencyKey, string? errorMessage = null)
Parameters
Properties
DependencyKey
依赖的配置键
public string DependencyKey { get; }
Property Value
ErrorMessage
自定义错误消息
public string? ErrorMessage { get; }
Property Value
Key
要验证的配置键
public string Key { get; }
Property Value
Name
规则名称
public string Name { get; }
Property Value
Methods
Validate(string?)
验证配置值
public ValidationError? Validate(string? value)
Parameters
valuestring配置值
Returns
- ValidationError
验证错误,如果验证通过返回 null