Skip to content

Simple and high-performance solution for creating sequential GUIDs. Does not fulfill the security requirements like GUIDs.

License

Notifications You must be signed in to change notification settings

dailydevops/sequentialguid

Repository files navigation

NetEvolve.SequentialGuid

Nuget Nuget

A .NET library to generate sequential GUIDs, similar to SQL Server's newsequentialid(). It's a drop-in replacement for System.Guid.NewGuid(), focusing on performance and low allocation.

Caution

The downside is that it's not as unique as System.Guid.NewGuid() and crypotographically insecure. So be sure to understand the trade-offs before using it.

Features

With the SequentialGuidType enum, you can choose between 3 different types of sequential GUIDs:

  • AsBinary
    The sequential part is at the beginning of the GUID, similar to Oracle's SYS_GUID().
  • AsString (Default)
    The sequential part is at the beginning of the GUID.
  • AtEnd
    The sequential part is at the end of the GUID, similar to SQL Server's newsequentialid().

Installation

dotnet add package NetEvolve.SequentialGuid

Usage

using NetEvolve.SequentialGuid;

Guid guid = SequentialGuidFactory.NewGuid(); // Default is SequentialGuidType.AsString
// or
Guid guid = SequentialGuidFactory.NewGuid(SequentialGuidType.AsBinary);

About

Simple and high-performance solution for creating sequential GUIDs. Does not fulfill the security requirements like GUIDs.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published