ApricotFramework.IdGeneration 0.1.0

Prefix Reserved
dotnet add package ApricotFramework.IdGeneration --version 0.1.0
                    
NuGet\Install-Package ApricotFramework.IdGeneration -Version 0.1.0
                    
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="ApricotFramework.IdGeneration" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ApricotFramework.IdGeneration" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="ApricotFramework.IdGeneration" />
                    
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 ApricotFramework.IdGeneration --version 0.1.0
                    
#r "nuget: ApricotFramework.IdGeneration, 0.1.0"
                    
#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 ApricotFramework.IdGeneration@0.1.0
                    
#: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=ApricotFramework.IdGeneration&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=ApricotFramework.IdGeneration&version=0.1.0
                    
Install as a Cake Tool

ApricotFramework.IdGeneration

NuGet NuGet CI License

Identifier generation for .NET: self-describing prefixed strings such as usr-3f2a… for identifiers you hand out, and time-ordered UUIDv7 Guid values for keys the database owns.

ApricotFramework.IdGeneration is the zero-dependency core.

Install

dotnet add package ApricotFramework.IdGeneration
dotnet add package ApricotFramework.IdGeneration.AspNetCore

Usage

using ApricotFramework.IdGeneration.AspNetCore.Extensions;

builder.Services.AddIdGeneration();
using ApricotFramework.IdGeneration;

// A prefixed string identifier: random, so it reveals nothing about when it was made.
string userId = idGenerator.Generate("usr");        // "usr-3f2a4c1e8b7d40f9a1c26e5d90b3f748"

// Read one back. Malformed input is a false, not an exception.
if (PrefixedId.TryParse(userId, out var parsed))
{
    Console.WriteLine($"{parsed.Prefix} / {parsed.Uuid}");
}

// A key for a native uuid column: UUIDv7, so successive rows sort together in the index.
Guid key = uuidGenerator.Generate();

The prefixed string form, {prefix}-{32 lowercase hex characters}, is what consumers persist, so it is a compatibility contract and will not change without a major version. The two generators differ deliberately: string identifiers are UUIDv4 because they travel in URLs and payloads, while a UUIDv7 carries the millisecond it was created in — excellent for index locality, wrong for something you hand to a client.

Full documentation: https://projectapricot.dev

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ApricotFramework.IdGeneration:

Package Downloads
ApricotFramework.IdGeneration.AspNetCore

ASP.NET Core integration for ApricotFramework.IdGeneration: one call registers the prefixed string id generator and the UUIDv7 Guid generator as singletons.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 174 8/14/2026