Table of Contents

Class ValidationResult

Namespace
Cratis.Applications.Validation
Assembly
Cratis.Applications.dll

Represents the an failed validation rule.

public record ValidationResult : IEquatable<ValidationResult>
Inheritance
ValidationResult
Implements
Inherited Members
Extension Methods

Constructors

ValidationResult(ValidationResultSeverity, string, IEnumerable<string>, object)

Represents the an failed validation rule.

public ValidationResult(ValidationResultSeverity Severity, string Message, IEnumerable<string> Members, object State)

Parameters

Severity ValidationResultSeverity

The ValidationResultSeverity of the result.

Message string

Message of the error.

Members IEnumerable<string>

Collection of member names that caused the failure.

State object

State associated with the validation result.

Properties

Members

Collection of member names that caused the failure.

public IEnumerable<string> Members { get; init; }

Property Value

IEnumerable<string>

Message

Message of the error.

public string Message { get; init; }

Property Value

string

Severity

The ValidationResultSeverity of the result.

public ValidationResultSeverity Severity { get; init; }

Property Value

ValidationResultSeverity

State

State associated with the validation result.

public object State { get; init; }

Property Value

object

Methods

Error(string, IEnumerable<string>?, object?)

Creates a new ValidationResult representing an error.

public static ValidationResult Error(string message, IEnumerable<string>? members = null, object? state = null)

Parameters

message string

Message of the error.

members IEnumerable<string>

Collection of member names that caused the error.

state object

State associated with the validation result.

Returns

ValidationResult

A ValidationResult.

Warning(string, IEnumerable<string>?, object?)

Creates a new ValidationResult representing a warning.

public static ValidationResult Warning(string message, IEnumerable<string>? members = null, object? state = null)

Parameters

message string

Message of the warning.

members IEnumerable<string>

Collection of member names that caused the warning.

state object

State associated with the validation result.

Returns

ValidationResult

A ValidationResult.