Skip to content

GetPrimaryKey Method ​

Definition ​

  • Namespace: JASE
  • Assembly: JASE.IdGenerator.dll

Overloads ​

NameDescription
long GetPrimaryKey(Guid id)Derives a clustered 64-bit key from a UUIDv7 or SQL Server COMB value. Layout: upper 48 bits = timestamp (ms since Unix epoch), lower 16 bits = ordered counter/node payload (random tail discarded).
long GetPrimaryKey(string id)Derives a clustered 64-bit key from a UUIDv7 or SQL Server COMB value. Layout: upper 48 bits = timestamp (ms since Unix epoch), lower 16 bits = ordered counter/node payload (random tail discarded).

long GetPrimaryKey(Guid id) ​

csharp
long GetPrimaryKey(Guid id)

Derives a clustered 64-bit key from a UUIDv7 or SQL Server COMB value. Layout: upper 48 bits = timestamp (ms since Unix epoch), lower 16 bits = ordered counter/node payload (random tail discarded).

Remarks ​

Accepts UUIDv7 (RFC 9562) and JASE SQL Server COMB (version 8). The resulting long is monotonically increasing for typical single-writer workloads and suitable as a clustered BIGINT key.

Uniqueness contract: the derived key keeps only the timestamp and the small ordered payload — it does not include the UUID's random bits. Uniqueness is guaranteed only within a single generator process, or across at most 16 processes when UseNode is enabled and each writer has a distinct node id (0–15 via SetNodeId or JASE_NODE_ID). For multi-writer 64-bit IDs without that 16-node cap, use OrderedIdGenerator.

long GetPrimaryKey(string id) ​

csharp
long GetPrimaryKey(string id)

Derives a clustered 64-bit key from a UUIDv7 or SQL Server COMB value. Layout: upper 48 bits = timestamp (ms since Unix epoch), lower 16 bits = ordered counter/node payload (random tail discarded).

Remarks ​

Accepts UUIDv7 (RFC 9562) and JASE SQL Server COMB (version 8). The resulting long is monotonically increasing for typical single-writer workloads and suitable as a clustered BIGINT key.

Uniqueness contract: the derived key keeps only the timestamp and the small ordered payload — it does not include the UUID's random bits. Uniqueness is guaranteed only within a single generator process, or across at most 16 processes when UseNode is enabled and each writer has a distinct node id (0–15 via SetNodeId or JASE_NODE_ID). For multi-writer 64-bit IDs without that 16-node cap, use OrderedIdGenerator.