⚖️Comparable

For types that implement IComparable<T>

LessThan Validator

Ensures that the value is less than the specified value.

Example:

builder.OfInt().For("Age").LessThan(120);

Example error: 'Age' must be less than 120.

String format args:

  • Name: Name of the type being validated

  • Value: Current value of the property

  • ComparisonValue: Value compared to.

LessThanOrEqual Validator

Ensures that the value is less than or equal to the specified value.

Example:

builder.OfInt().For("Age").LessThanOrEqualTo(120);

Example error: 'Age' must be less than or equal to 120.

String format args:

  • Name: Name of the type being validated

  • Value: Current value of the property

  • ComparisonValue: Value compared to.

GreaterThan Validator

Ensures that the value is greater than the specified value.

Example:

builder.OfInt().For("Age").GreaterThan(120);

Example error: 'Age' must be greater than 120.

String format args:

  • Name: Name of the type being validated

  • Value: Current value of the property

  • ComparisonValue: Value compared to.

GreaterThanOrEqual Validator

Ensures that the value is greater than or equal to the specified value.

Example:

builder.OfInt().For("Age").GreaterThanOrEqualTo(120);

Example error: 'Age' must be greater than or equal to 120.

String format args:

  • Name: Name of the type being validated

  • Value: Current value of the property

  • ComparisonValue: Value compared to.

Last updated