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
SeverityValidationResultSeverityThe ValidationResultSeverity of the result.
MessagestringMessage of the error.
MembersIEnumerable<string>Collection of member names that caused the failure.
StateobjectState associated with the validation result.
Properties
Members
Collection of member names that caused the failure.
public IEnumerable<string> Members { get; init; }
Property Value
Message
Message of the error.
public string Message { get; init; }
Property Value
Severity
The ValidationResultSeverity of the result.
public ValidationResultSeverity Severity { get; init; }
Property Value
State
State associated with the validation result.
public object State { get; init; }
Property Value
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
messagestringMessage of the error.
membersIEnumerable<string>Collection of member names that caused the error.
stateobjectState associated with the validation result.
Returns
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
messagestringMessage of the warning.
membersIEnumerable<string>Collection of member names that caused the warning.
stateobjectState associated with the validation result.