![]() |
VOOZH | about |
dotnet add package UUIDNext --version 4.2.4
NuGet\Install-Package UUIDNext -Version 4.2.4
<PackageReference Include="UUIDNext" Version="4.2.4" />
<PackageVersion Include="UUIDNext" Version="4.2.4" />Directory.Packages.props
<PackageReference Include="UUIDNext" />Project file
paket add UUIDNext --version 4.2.4
#r "nuget: UUIDNext, 4.2.4"
#:package UUIDNext@4.2.4
#addin nuget:?package=UUIDNext&version=4.2.4Install as a Cake Addin
#tool nuget:?package=UUIDNext&version=4.2.4Install as a Cake Tool
A fast and modern .NET library to generate UUID/GUID that are either sequential and database friendly (versions 7 & 8), name based (versions 5) or random (version 4).
UUIDNext is available on nuget.org
using System;
using UUIDNext;
// Creating a database friendly UUID for PostgreSQL (version 7) or MS SQL Server (Version 8)
Guid postgreSqlUuid = Uuid.NewDatabaseFriendly(Database.PostgreSql);
Console.WriteLine($"This is a PostgreSQL friendly UUID : {postgreSqlUuid}");
Guid sqlServerUuid = Uuid.NewDatabaseFriendly(Database.SqlServer);
Console.WriteLine($"This is a SQL Server friendly UUID : {sqlServerUuid}");
// Creating a name based UUID (Version 5)
Guid nameBasedUuid = Uuid.NewNameBased(Uuid.Namespace.URL, "https://github.com/uuid6/uuid6-ietf-draft");
Console.WriteLine($"This is a name based UUID : {nameBasedUuid}");
The traditional GUID (a.k.a UUID Version 4) is fine and works really well for it's intended use. But its random nature is problematic in some scenarios that's why other UUID versions have been created.
UUID Version 3 and 5 are name-based UUIDs. They take a namespace and a name as input and produce a hash-like UUID. Usage of Version 3 is discouraged as it is based on the obsolete MD5 hash function.
UUID Version 7 and 8 are intended to be used as a primary key in a database. The randomness of UUID V4 has a negative impact on performance when used as a key in a database and UUID V1 exposed the MAC address of the machine where it was created. UUID V7 & 8 aims to take the best of both worlds without their drawbacks.
As I said, UUIDs V4 produced by Guid.NewGuid() are fine when they are not used in the scenarios described above and there's no reason to stop using them. But if you find yourself in a position where UUID V4 is suboptimal, this library is for you.
The fact that the .NET team added UUID v7 support is a good news but their implementation is pretty simple : it's just a timestamp in ms completed by random data. This may be fine in some use cases but can cause issue in others. To sum up, you should use UUIDNext if you're in one of these situations:
If you have some special needs, the UuidToolkit class offers a variety of helper methods To create custom UUIDs.
If you want to retrieve some information from a UUID like its version or the date when it as created, check the UuidDecoder class.
RFC 9562 : The new standard for UUID Version 1 to 8.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on UUIDNext:
| Package | Downloads |
|---|---|
|
Cortside.DomainEvent.EntityFramework
Library for sending AMQP 1.0 messages using Outbox Pattern and EntityFramework |
|
|
Nuuvify.CommonPack.Extensions
This library implements Notification Pattern, which allows passing notifications between projects. Here there are also several extension methods that help handle null lists, special characters in strings, among other useful things. |
|
|
NetCorePal.Extensions.Repository.EntityFrameworkCore
NetCorePal Cloud Framework |
|
|
Nuuvify.CommonPack.Domain
Biblioteca com implementacces comuns para projetos DOMAIN |
|
|
Beckett
Messaging and event sourcing library |
Showing the top 1 popular GitHub repositories that depend on UUIDNext:
| Repository | Stars |
|---|---|
|
netcorepal/netcorepal-cloud-framework
一个基于ASP.NET Core实现的整洁领域驱动设计落地战术框架。 A tactical framework for Clean Domain-Driven Design based on ASP.NET Core.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 4.2.4 | 355,434 | 4/4/2026 |
| 4.2.3 | 763,382 | 1/11/2026 |
| 4.2.2 | 498,958 | 10/28/2025 |
| 4.2.1 | 107,354 | 10/5/2025 |
| 4.2.0 | 160,551 | 9/1/2025 |
| 4.1.2 | 1,101,682 | 4/29/2025 |
| 4.1.1 | 496,531 | 2/13/2025 |
| 4.1.0 | 436,586 | 1/26/2025 |
| 4.0.0 | 378,324 | 12/4/2024 |
| 4.0.0-beta3 | 500 | 11/17/2024 |
| 4.0.0-beta2 | 732 | 10/24/2024 |
| 4.0.0-beta | 13,543 | 10/6/2024 |
| 3.0.0 | 1,446,064 | 7/2/2024 |
| 3.0.0-beta3 | 7,527 | 5/16/2024 |
| 3.0.0-beta2 | 156,551 | 1/24/2024 |
| 3.0.0-beta | 1,888 | 11/21/2023 |
| 2.0.2 | 2,373,401 | 6/8/2023 |
| 2.0.0 | 154,301 | 1/9/2023 |
| 1.1.1 | 57,746 | 4/25/2022 |