Skip to main content

Interface IValueObjectNormalizer<TValue>

Namespace: AdCodicem.ValueObjects
Assembly: AdCodicem.ValueObjects.Abstractions.dll

Declares that a value object normalizes its underlying value before validating it.

public interface IValueObjectNormalizer<TValue>

Type Parameters

TValue

Underlying value type.

Remarks

Implement this to give a value object a normalization rule: an IBAN without its separators and upper-cased, a phone number carrying its country code. The generator calls from the Normalize member of , which additionally guards against a null underlying value, so the rule itself never has to.

Normalization must be idempotent and must never reject: normalizing an already normalized value returns it unchanged, and a value that cannot be normalized is rejected by instead.

Methods

NormalizeValue(TValue)

Puts a value into its canonical form.

public static abstract TValue NormalizeValue(TValue value)

Parameters

value TValue

Value to normalize. Never null.

Returns

TValue

The canonical form of the value.