Skip to content

Skip Rules

Arif Yayalar (@ayayalar) edited this page Aug 24, 2018 · 1 revision

Marks the rule to be skipped.

Must be set in Initialize, or InitializeAsync method.
Example
class IsValidAmount : Rule<Order>
{
    public override IRuleResult Invoke()
    {
        if (Model.Amount <= 0.0m) throw new InvalidOperationException();            
        
        return null;
    }

    // Skip this rule
    public override void Initialize() => Configuration.Skip = true;        
}