The SnowflakeIdGenerator is a unique ID generation system designed to create globally unique, ordered, and highly efficient identifiers across distributed systems. Inspired by Twitter's original Snowflake design, it ensures that multiple nodes in different regions can generate IDs independently without collisions, while maintaining the overall order of creation.
$ dotnet add package SnowflakeSharpThe SnowflakeIdGenerator is a unique ID generation system designed to create globally unique, ordered, and highly efficient identifiers across distributed systems. Inspired by Twitter's original Snowflake design, it ensures that multiple nodes in different regions can generate IDs independently without collisions, while maintaining the overall order of creation.
` // Create a generator with workerID: 1 and datacenterID: 1 var generator = new SnowflakeIdGenerator(workerId: 1, datacenterId: 1);
// Generate IDs for (int i = 0; i < 10; i++) { long id = generator.NextId(); Console.WriteLine($"Generated ID: {id}"); }`
dotnet add package SnowflakeIdGenerator --version 1.0.0
or
Install-Package SnowflakeIdGenerator -Version 1.0.0
or
<PackageReference Include="SnowflakeIdGenerator" Version="1.0.0" />