Interface IValueObjectPatternValidator
Namespace: AdCodicem.ValueObjects
Assembly: AdCodicem.ValueObjects.Abstractions.dll
Declares that a string value object must match a regular expression.
public interface IValueObjectPatternValidator
Remarks
Implement it with a source-generated regular expression, which the regex generator can only write for code a
consumer wrote by hand:
[GeneratedRegex("^[A-Z]{3}$", RegexOptions.CultureInvariant, matchTimeoutMilliseconds: 1000)] public static partial Regex Pattern { get; }.
It runs compiled under native AOT, where a
The pattern runs after MinLength and MaxLength, before the known values and
pattern, read off the [GeneratedRegex] attribute when the type compiles. That text carries no
It replaces the Pattern option of [ValueObject<T>], which builds its regular expression at
run time. Implementing it on a value object that is not a string, or on an [EntityId], which owns its
format, is a build error.
Properties
Pattern
Gets the regular expression a value must match.
public static abstract Regex Pattern { get; }