Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

Latest commit

 

History

History
34 lines (24 loc) · 1.33 KB

README.md

File metadata and controls

34 lines (24 loc) · 1.33 KB

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