Table of Contents

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

key string

配置键

dependencyKey string

依赖的配置键

errorMessage string

自定义错误消息

Properties

DependencyKey

依赖的配置键

public string DependencyKey { get; }

Property Value

string

ErrorMessage

自定义错误消息

public string? ErrorMessage { get; }

Property Value

string

Key

要验证的配置键

public string Key { get; }

Property Value

string

Name

规则名称

public string Name { get; }

Property Value

string

Methods

Validate(string?)

验证配置值

public ValidationError? Validate(string? value)

Parameters

value string

配置值

Returns

ValidationError

验证错误,如果验证通过返回 null