Table of Contents

Class RuleEvaluationResult

Namespace
JD.Domain.Abstractions
Assembly
JD.Domain.Abstractions.dll

Represents the result of evaluating domain rules against an instance.

public sealed class RuleEvaluationResult
Inheritance
RuleEvaluationResult
Inherited Members

Properties

Errors

Gets the collection of errors from failed rules.

public IReadOnlyList<DomainError> Errors { get; init; }

Property Value

IReadOnlyList<DomainError>

Info

Gets the collection of informational messages from rules.

public IReadOnlyList<DomainError> Info { get; init; }

Property Value

IReadOnlyList<DomainError>

IsValid

Gets a value indicating whether all rules passed.

public bool IsValid { get; init; }

Property Value

bool

Metadata

Gets additional evaluation metadata.

public IReadOnlyDictionary<string, object?> Metadata { get; init; }

Property Value

IReadOnlyDictionary<string, object>

RuleSetsEvaluated

Gets the names of rule sets that were evaluated.

public IReadOnlyList<string> RuleSetsEvaluated { get; init; }

Property Value

IReadOnlyList<string>

RulesEvaluated

Gets the total number of rules evaluated.

public int RulesEvaluated { get; init; }

Property Value

int

Warnings

Gets the collection of warnings from rules.

public IReadOnlyList<DomainError> Warnings { get; init; }

Property Value

IReadOnlyList<DomainError>

Methods

Failure(params DomainError[])

Creates a failed evaluation result with the specified errors.

public static RuleEvaluationResult Failure(params DomainError[] errors)

Parameters

errors DomainError[]

The errors.

Returns

RuleEvaluationResult

An invalid evaluation result.

Failure(IReadOnlyList<DomainError>)

Creates a failed evaluation result with the specified errors.

public static RuleEvaluationResult Failure(IReadOnlyList<DomainError> errors)

Parameters

errors IReadOnlyList<DomainError>

The collection of errors.

Returns

RuleEvaluationResult

An invalid evaluation result.

Success()

Creates a successful evaluation result with no errors.

public static RuleEvaluationResult Success()

Returns

RuleEvaluationResult

A valid evaluation result.