ByteAether.Ulid.AspNetCore 1.4.2-rc.0

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

ULID Integration for ASP.NET Core

from ByteAether

License .NET 10.0 .NET 9.0 .NET 8.0 .NET 7.0 .NET 6.0 NuGet Version NuGet Downloads

Adds ASP.NET Core support for ByteAether.Ulid.

✨ Features

  • Route constraints: register a :ulid route parameter policy that accepts only valid ULID values.
  • JSON support: Ulid and Ulid? serialize as canonical 26-character strings without extra configuration in reflection-enabled applications.
  • OpenAPI support: expose ULIDs as strings with the ulid format in Swashbuckle and ASP.NET Core OpenAPI.
  • AOT-friendly: compatible with Native AOT; ASP.NET Core source-generated JSON metadata is required for application types.

For the core library and full details, see the GitHub repository.

💾 Install

dotnet add package ByteAether.Ulid.AspNetCore

The package depends on ByteAether.Ulid. OpenAPI packages are optional and are not added transitively.

🚀 Routes and JSON

No extra packages are required for route constraints or JSON serialization.

using ByteAether.Ulid;
using ByteAether.Ulid.AspNetCore;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddUlidRouteConstraint();

var app = builder.Build();
app.MapGet("/users/{id:ulid}", (Ulid id) => Results.Ok(new UserResponse(id)));
app.Run();

public record UserResponse(Ulid Id);

Behavior:

  • route parameters must match a valid ULID, otherwise the route does not match
  • Minimal API and MVC model binding accept valid ULID route and query values
  • link generation accepts Ulid values for :ulid route parameters
  • Ulid values in JSON bodies and responses use canonical 26-character strings; nullable values remain JSON null

Native AOT JSON

For Native AOT Minimal APIs, include Ulid and every request/response type in a source-generated JsonSerializerContext, then register that context:

using ByteAether.Ulid;
using System.Text.Json.Serialization;

builder.Services.ConfigureHttpJsonOptions(options =>
	options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonSerializerContext.Default));

[JsonSerializable(typeof(Ulid))]
[JsonSerializable(typeof(UserResponse))]
internal partial class AppJsonSerializerContext : JsonSerializerContext
{
}

📘 Optional OpenAPI support

Choose the OpenAPI integration you already use. Install only that package; this package does not add either dependency automatically.

Built-in ASP.NET Core OpenAPI (.NET 9 and 10)

dotnet add package Microsoft.AspNetCore.OpenApi
builder.Services.AddOpenApi(options => options.AddUlidSchemaTransformer());
app.MapOpenApi();

For built-in OpenAPI, use the matching ASP.NET Core version:

  • .NET 9: Microsoft.AspNetCore.OpenApi 9.0.0 or newer
  • .NET 10: Microsoft.AspNetCore.OpenApi 10.0.0 or newer

Swashbuckle (.NET 6–10)

dotnet add package Swashbuckle.AspNetCore
builder.Services.AddSwaggerGen(options => options.SchemaFilter<UlidSchemaFilter>());
app.UseSwagger();

For Swashbuckle, use a version compatible with your target framework:

  • .NET 6–9: 6.0.0 or newer
  • .NET 10: 10.0.0 or newer

📜 License

This project is licensed under the MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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 is compatible.  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 is compatible.  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 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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.4.2-rc.0 50 10/5/2026