AgentPrismId
AgentPrism.Abstractions.dllUUID version 7 generator for AgentPrism identifiers (RFC 9562).
public static class AgentPrismIdInheritance
Section titled “Inheritance”Inherited Members
Section titled “Inherited Members”object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”A UUIDv7 is time ordered: the first 48 bits are a Unix millisecond stamp.
This keeps B-tree indexes from fragmenting and makes ORDER BY id
return time order. It also avoids the central sequence bottleneck of
bigserial.
We use our own implementation instead of Guid.CreateVersion7 from.NET 9. The reason: the package also targets net8.0, and storage keys
must be produced the same way on every target.
Methods
Section titled “Methods”GetTimestamp(Guid)
Section titled “ GetTimestamp(Guid)”Reads the time stamp back out of a UUIDv7.
public static DateTimeOffset GetTimestamp(Guid id)Parameters
Section titled “Parameters”id Guid
The UUIDv7 value.
Returns
Section titled “Returns”The time stamp embedded in the identifier.
Exceptions
Section titled “Exceptions”id is not a version 7 value.
NewId()
Section titled “ NewId()”Creates a new UUIDv7 stamped with the current time.
public static Guid NewId()Returns
Section titled “Returns”A time-ordered identifier.
NewId(DateTimeOffset)
Section titled “ NewId(DateTimeOffset)”Creates a UUIDv7 stamped with the given time.
public static Guid NewId(DateTimeOffset timestamp)Parameters
Section titled “Parameters”timestamp DateTimeOffset
The time stamp to embed in the identifier.
Returns
Section titled “Returns”A time-ordered identifier.