Class EntityIdPrefix
Namespace: AdCodicem.ValueObjects.Identifiers
Assembly: AdCodicem.ValueObjects.Identifiers.dll
The rules a declared prefix must satisfy.
public static class EntityIdPrefix
Inheritance
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks
The generator enforces these at compile time through VO0015, so a malformed prefix never reaches a
running application. They are restated here because the runtime factories are public and a hand-written
identifier type can reach them without passing through the generator.
Fields
MaxLength
The greatest total length of a prefix, separators included.
public const int MaxLength = 16
Field Value
MaxSegmentLength
The greatest length of one segment.
public const int MaxSegmentLength = 8
Field Value
Separator
The separator between the prefix and the body, and between the segments of a multi-segment prefix.
public const char Separator = '_'
Field Value
Methods
IsValid(string?, out string?)
Determines whether a prefix is usable, and says why when it is not.
public static bool IsValid(string? prefix, out string? error)
Parameters
prefix string?
Prefix to check, without its trailing separator.
error string?
The rule that was broken, or null when the prefix is usable.
Returns
true when prefix is usable.
ThrowIfInvalid(string?, string)
Throws when a prefix is unusable.
public static void ThrowIfInvalid(string? prefix, string parameterName)
Parameters
prefix string?
Prefix to check.
parameterName string
Name of the argument being validated.
Exceptions
prefix breaks one of the rules.