A collection of .NET implementations for generating unique identifiers.
This solution contains implementations for various unique identifier algorithms:
- Aoxe.SequentialGuid: Generates sequential GUIDs suitable for database indexing.
- Aoxe.Snowflake: Implementation of the Snowflake algorithm for generating unique 64-bit integers.
- Aoxe.Ulid: Generates ULIDs (Universally Unique Lexicographically Sortable Identifiers).
- Aoxe.UUIDv7: Implementation of UUID version 7.
- Aoxe.Identifier.sln: The main solution file.
- src: Contains the source code for each identifier implementation.
- Aoxe.SequentialGuid/: Sequential GUID implementation.
- Aoxe.Snowflake/: Snowflake algorithm implementation.
- Aoxe.Ulid/: ULID implementation.
- Aoxe.UUIDv7/: UUIDv7 implementation.
- tests: Contains test projects for each implementation.
- Aoxe.SequentialGuid.TestProject/: Tests for Sequential GUID.
- Aoxe.Snowflake.TestProject/: Tests for Snowflake.
- Aoxe.UUIDv7.TestProject/: Tests for UUIDv7.
- Aoxe.Ulid.TestProject/: Test project for ULID implementation.
- .NET SDK installed.
To build the solution, run:
dotnet build Aoxe.Identifier.sln
To run all unit tests, execute:
dotnet test Aoxe.Identifier.sln
Use the UlidGenerator
class in Aoxe.Ulid:
var ulid = UlidGenerator.NewUlid();
Console.WriteLine(ulid);
Use the SnowflakeGenerator
class in Aoxe.Snowflake:
var generator = new SnowflakeIdGenerator(1, 1);
var snowflakeId = generator.NextId();
Console.WriteLine(snowflakeId);
Use the SequentialGuidGenerator
class in Aoxe.SequentialGuid:
var sequentialGuid = SequentialGuidGenerator.NewGuid();
Console.WriteLine(sequentialGuid);
Use the Uuid7Generator
class in Aoxe.UUIDv7:
var uuid7 = Uuid7Generator.NewUuid7();
Console.WriteLine(uuid7);
This project is licensed under the MIT License.