ValidationModel Structure

Represents information returned when an attempt to validate a model was made.

Definition

Namespace: MobileTrack.Common.Models
Assembly: MobileTrack.Common (in MobileTrack.Common.dll) Version: 0.7+ce90b2cf6b782b8d7b7fd47b3c546987c652c00f
public readonly struct ValidationModel : IEquatable<ValidationModel>
Inheritance
Object    ValueType    ValidationModel
Implements
IEquatableValidationModel

Remarks

This model is created because we don't want to throw exceptions if the user makes an error; user errors should be caught with models like these, exceptions are to be used for technical malfunctions, illegal operations or other unexpected behaviors.

The StatusCode tells us what the issue is, the I18nKey is a localization key to a human-readable message,
and Property tells us which property is causing issues.
If no error is found, the StatusCode will be 'Ok'. In this case, the other properties should be ignored.

Properties

IsError Whether an error was found.

Methods

Equals(Object) Whether one validation result equals the other.
(Overrides ValueTypeEquals(Object))
Equals(ValidationModel) Whether one validation result equals the other.
Error Invoked when an issue has been found while running the validator.
GetHashCode Hash code generator which only returns the StatusCode (as integer)
(Overrides ValueTypeGetHashCode)
ToString ToString override, only to be used to debug. Do not use for localization or user-facing messages.
(Overrides ValueTypeToString)

Operators

Equality(ValidationModel, ValidationModel) Whether two validations are the same.
Inequality(ValidationModel, ValidationModel) Whether two validations are not the same.

Fields

I18nKey The I18nKey representing the issue the validator found. (if applicable)
Ok Represents a successful validation.
Property Property of the failed item. Can be left empty if 'OK'.
StatusCode The status code return when exiting the model validator. If it is not 'Ok' there is a problem present.

See Also