Class ValueObjectValidationResult
Namespace: AdCodicem.ValueObjects.Annotations
Assembly: AdCodicem.ValueObjects.Abstractions.dll
The result DataAnnotations reports a refusal of
public sealed class ValueObjectValidationResult : ValidationResult
Inheritance
object ← ValidationResult ← ValueObjectValidationResult
Inherited Members
ValidationResult.Success, ValidationResult.ToString(), ValidationResult.ErrorMessage, ValidationResult.MemberNames, object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks
A host that hands the result back keeps the code: Validator.TryValidateObject, TryValidateProperty and
TryValidateValue list it as it is, and so does CommunityToolkit.Mvvm's ObservableValidator.GetErrors. A
host that keeps the message alone loses it: MVC's model state, the errors of AddValidation(), the failures of
options validation. The message never carries the code, nor the value refused.
It is the
Constructors
ValueObjectValidationResult(string, IEnumerable<string>?, Type, string)
Creates the result of a refusal.
public ValueObjectValidationResult(string errorMessage, IEnumerable<string>? memberNames, Type valueObjectType, string errorCode)
Parameters
errorMessage string
The message, as the host shows it.
memberNames IEnumerable<string>?
The members the refusal is reported under, or null for none.
valueObjectType Type
The value object whose rule refused the value.
errorCode string
The code of the rule, one of
Exceptions
valueObjectType or errorCode is null.
errorCode is empty.
Properties
ErrorCode
Gets the code of the rule that refused the value, one of
public string ErrorCode { get; }
Property Value
ValueObjectType
Gets the value object whose rule refused the value.
public Type ValueObjectType { get; }