Skip to content

UuidGenerator Class ​

Definition ​

Instance UUID generator with frozen options and its own monotonic counters.

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

Constructors ​

NameDescription
UuidGenerator()Creates a generator with default options (no node embedding, fast PRNG).
UuidGenerator(UuidGeneratorOptions options)Creates a generator whose options are frozen for the lifetime of the instance.

Properties ​

NameDescription
NodeIdNode id (0..15) embedded when UseNode is enabled.
UseCsprngWhether UUID tails are filled from a CSPRNG.
UseNodeWhether a 4-bit node id is embedded in V7 and COMB values.

Methods ​

NameDescription
Guid Generate(UuidType uuidType)Generates a UUID of the requested type.
Guid GenerateForPostgreSql()Generate a PostgreSQL-friendly UUIDv7 (same layout as GenerateV7).
Guid GenerateForSqlServer()Generate a SQL Server–friendly COMB-style GUID with timestamp in the high-order sort bytes for better clustered index locality.
Guid GenerateV4()Generates a UUID V4 identifier.
Guid GenerateV7()Generates a UUID V7 identifier.
Guid SeedSqlServer(DateTimeOffset timestamp, int sequence = null)Builds a SQL Server COMB whose sortable timestamp is timestamp, without touching this generator's live monotonic counter.
Guid SeedV7(DateTimeOffset timestamp, int sequence = null)Builds a UUIDv7 whose timestamp is timestamp, without touching this generator's live monotonic counter.

Remarks ​

Use this type when two libraries in one process must not share UuidFactory configuration. UuidFactory is the process-wide facade used by the JASE Suite.

Independent instances have independent per-millisecond counters. Full GUID values remain unique via their random bits; GetPrimaryKey uniqueness is per generator unless UseNode is enabled with a distinct NodeId.