Skip to main content
Version: 0.3.x (0.3.0)

Class EntityIdDescriptor

Namespace: AdCodicem.ValueObjects.Identifiers
Assembly: AdCodicem.ValueObjects.Identifiers.dll

Runtime description of one entity identifier type, reachable from its prefix alone.

public sealed class EntityIdDescriptor

Inheritance​

object ← EntityIdDescriptor

Inherited Members​

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Remarks​

The delegate it carries operates on boxed values, which is acceptable for the same reason it is on : this is the path taken by callers that only know a prefix at run time — a webhook dispatcher, a deep link, an audit trail. Request paths that know their type go through the static members of and stay fully typed.

Properties​

Granularity​

Gets the width of the time bucket heading the body.

public IdGranularity Granularity { get; }

Property Value​

IdGranularity

Length​

Gets the exact length of an identifier of this type, which is also the width of its database column.

public int Length { get; }

Property Value​

int

Prefix​

Gets the prefix the type claims, without its trailing separator.

public string Prefix { get; }

Property Value​

string

TryParse​

Gets the non-throwing text parser, producing a boxed identifier.

public BoxedTryParse TryParse { get; }

Property Value​

BoxedTryParse

ValueObjectType​

Gets the identifier type.

public Type ValueObjectType { get; }

Property Value​

Type

Methods​

Accept<TResult>(IEntityIdVisitor<TResult>)​

Hands the identifier type to a visitor, closed at compile time where the descriptor was built.

public TResult Accept<TResult>(IEntityIdVisitor<TResult> visitor)

Parameters​

visitor IEntityIdVisitor<TResult>

The visitor.

Returns​

TResult

What the visitor built for the identifier type.

Type Parameters​

TResult

What the visitor builds.

Remarks​

Every descriptor is built by , the generated registration's included, so every descriptor holds can be visited, without reflection and under native AOT.

Exceptions​

ArgumentNullException

visitor is null.

For<TSelf>()​

Builds a descriptor, resolving every operation statically.

public static EntityIdDescriptor For<TSelf>() where TSelf : struct, IEntityId<TSelf>

Returns​

EntityIdDescriptor

The descriptor.

Type Parameters​

TSelf

Identifier type.