百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
U

UUIDNext

> 编程语言
开源

一个快速、现代的 .NET 库,可生成顺序且与数据库兼容的 UUID/GUID(版本 7)、基于名称的 UUID/GUID(版本 5)或随机的 UUID/GUID(版本 4)。

382 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个快速、现代的 .NET 库,可生成顺序且与数据库兼容的 UUID/GUID(版本 7)、基于名称的 UUID/GUID(版本 5)或随机的 UUID/GUID(版本 4)。

UUIDNext

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).

How to Install

UUIDNext is available on nuget.org

How to Use

…

What are all these versions ? I didn't know there were so many types of GUID

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.

Why creating a new Library ? is there a problem with Guid.NewGuid() ?

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.

Now that .NET 9 can generate UUID v7, do I still need this library ?

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:

  • You target a .NET version older than .NET 9 (obviously).
  • You use MS SQL Server. UUIDNext is the only library that generate UUIDs tailored for SQL Server.
  • You do a lot of batch inserts. Contrary to .NET 9, UUIDNext ensure that each generated UUID is greater than the previous one even if they're generated in the same ms.

But wait, there's more !

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.

Resources

Documentation.

RFC 9562 : The new standard for UUID Version 1 to 8.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#guiduuid

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言