Baubit.Identity 2025.51.1

dotnet add package Baubit.Identity --version 2025.51.1
                    
NuGet\Install-Package Baubit.Identity -Version 2025.51.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Baubit.Identity" Version="2025.51.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Baubit.Identity" Version="2025.51.1" />
                    
Directory.Packages.props
<PackageReference Include="Baubit.Identity" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Baubit.Identity --version 2025.51.1
                    
#r "nuget: Baubit.Identity, 2025.51.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Baubit.Identity@2025.51.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Baubit.Identity&version=2025.51.1
                    
Install as a Cake Addin
#tool nuget:?package=Baubit.Identity&version=2025.51.1
                    
Install as a Cake Tool

Baubit.Identity

CircleCI codecov<br/> NuGet NuGet <br/> .NET Standard 2.0 License: MIT<br/> Known Vulnerabilities

A monotonic GuidV7 (UUIDv7) generator for .NET. Generates strictly increasing unique identifiers for distributed systems.

Features

  • Interface-based Design: IIdentityGenerator interface for abstraction and testability
  • Monotonic Guarantees: Strictly increasing UUIDv7 identifiers, even at the same millisecond
  • Thread-Safe: Lock-free implementation using atomic operations
  • Drift Protection: Optional drift cap for clock skew handling
  • Timestamp Extraction: Extract Unix milliseconds from GuidV7 values
  • Zero Dependencies: No external dependencies
  • RFC 9562 Compliant: Follows UUIDv7 specification

Installation

dotnet add package Baubit.Identity

Quick Start

using Baubit.Identity;

// Create a generator using the interface
IIdentityGenerator generator = IdentityGenerator.CreateNew();

// Generate monotonic GuidV7 values
var id1 = generator.GetNext();
var id2 = generator.GetNext();
// id1 < id2 (strictly increasing)

// Seed from existing GUID or timestamp
var existingId = GuidV7.CreateVersion7();
generator.InitializeFrom(existingId);

// Or seed from timestamp
generator.InitializeFrom(DateTimeOffset.UtcNow.AddHours(-1));

// Create UUIDv7 directly
var guid = GuidV7.CreateVersion7();

// Extract timestamp
if (GuidV7.TryGetUnixMs(guid, out long ms))
{
    var time = DateTimeOffset.FromUnixTimeMilliseconds(ms);
}

API Reference

IIdentityGenerator (Interface)

  • GetNext() - Generate next monotonic GUID using current UTC time
  • GetNext(DateTimeOffset timestampUtc) - Generate monotonic GUID with specific timestamp
  • InitializeFrom(Guid existingV7) - Seed from existing version 7 GUID
  • InitializeFrom(DateTimeOffset timestampUtc) - Seed from specific UTC timestamp

IdentityGenerator

  • CreateNew(long? maxDriftMs = null, bool throwOnDriftCap = false) - Create generator with optional drift protection
  • CreateNew(Guid existingV7, long? maxDriftMs = null, bool throwOnDriftCap = false) - Create generator seeded from existing UUIDv7
  • GetNext() - Generate next monotonic GUID
  • GetNext(DateTimeOffset timestampUtc) - Generate monotonic GUID with specific timestamp
  • InitializeFrom(Guid existingV7) - Seed from existing version 7 GUID
  • InitializeFrom(DateTimeOffset timestampUtc) - Seed from specific UTC timestamp

GuidV7 (Static)

  • CreateVersion7() - Create UUIDv7 with current UTC time
  • CreateVersion7(DateTimeOffset timestamp) - Create UUIDv7 with specific timestamp
  • IsVersion7(Guid guid) - Check if GUID is version 7
  • TryGetUnixMs(Guid guid, out long ms) - Extract timestamp from UUIDv7

GuidV7Generator

  • CreateNew(long? maxDriftMs, bool throwOnDriftCap) - Create generator
  • CreateNew(Guid existingV7, ...) - Create generator seeded from existing UUIDv7
  • GetNext() - Generate next monotonic GuidV7
  • GetNext(DateTimeOffset timestampUtc) - Generate with specific timestamp
  • InitializeFrom(Guid existingV7) - Seed from existing UUIDv7
  • InitializeFrom(DateTimeOffset timestampUtc) - Seed from timestamp

GuidV7Extensions

  • ExtractTimestampMs(this Guid guid) - Extension to extract timestamp

Performance

Benchmarks comparing Baubit.Identity against .NET 9's built-in Guid.CreateVersion7() (Intel Core Ultra 9 185H, Windows 11):

Method Mean Ratio Allocated
.NET 9 CreateVersion7() 67.09 ns -11% 0 B
Baubit CreateVersion7() 75.40 ns baseline 0 B
Baubit Generator GetNext() 78.54 ns +4% 0 B

Key Highlights:

  • Zero allocations - All methods produce zero heap allocations
  • Competitive performance - Within 11% of .NET 9's native implementation
  • Monotonic guarantee - Generator provides strict ordering at only 4% cost
  • .NET Standard 2.0 - Broad compatibility with minimal performance trade-off

For detailed benchmark results, analysis, and hardware specifications, see Performance Report.

Note: Baubit.Identity targets .NET Standard 2.0 for broad compatibility. The implementation uses cryptographically secure random number generation (RandomNumberGenerator) with thread-local caching for zero allocations.

License

MIT License - see LICENSE

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Baubit.Identity:

Package Downloads
Baubit.Caching

Thread-safe insertion-ordered cache with O(1) lookups, two-tier storage (bounded L1, unbounded L2), and async enumeration. Provides deletion-resilient iteration, automatic multi-consumer memory management, and zero-latency producer-consumer coordination using GuidV7 time-ordered identifiers. Ideal for event sourcing, audit logs, message queues, and time-series caching scenarios.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2025.51.1 3,025 12/21/2025
2025.48.2 1,214 11/27/2025
2025.48.1 318 11/26/2025
2025.45.2 265 11/5/2025
2025.45.1 192 11/5/2025