Table of Contents

Class ArgumentValidator<T>

Namespace
Acuit.Pinpoint.Workflows.Validation
Assembly
Acuit.Pinpoint.Workflows.dll

An argument validator.

public sealed class ArgumentValidator<T>

Type Parameters

T

The argument value type.

Inheritance
ArgumentValidator<T>
Inherited Members

Remarks

Fluent validation methods follow the conventions of validation data annotation attributes:

  • When argument types are nullable, validation methods like IsNotNull<T>(ArgumentValidator<T>) can be used to ensure they have a value (similar to annotating a property with [RequiredAttribute]).
  • Validation methods that perform various checks against values (like IsGreaterThan<T>(ArgumentValidator<T>, T)) will not perform their validation check when the value is nullable and its value is null.

Thus, validation for various types should be performed like this:

  • Required arguments for reference types (e.g., string) should always start with a check to ensure the value is not null (e.g., IsNotNull<T>(ArgumentValidator<T>) or IsNotNullOrEmpty(ArgumentValidator<string>)), followed by whatever special validation is required.
  • Required arguments for value types (e.g., int) should not use nullable types and can simply include whatever special validation is required.
  • Optional arguments for reference types should simply include whatever special validation is required.
  • Optional arguments for value types should use nullable types and simply include whatever special validation is required.

Constructors

ArgumentValidator(T, string)

Initializes a new instance of the ArgumentValidator<T> class.

public ArgumentValidator(T value, string propertyName)

Parameters

value T

The argument value.

propertyName string

The workflow argument property name, which will be used in error exception messages.

Exceptions

ArgumentNullException

propertyName is null.

Properties

PropertyName

Gets the workflow argument property name, which will be used in error exception messages.

public string PropertyName { get; }

Property Value

string

Value

Gets the argument value.

public T Value { get; }

Property Value

T