Sqiddler.Core 0.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Sqiddler.Core --version 0.0.2
                    
NuGet\Install-Package Sqiddler.Core -Version 0.0.2
                    
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="Sqiddler.Core" Version="0.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sqiddler.Core" Version="0.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Sqiddler.Core" />
                    
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 Sqiddler.Core --version 0.0.2
                    
#r "nuget: Sqiddler.Core, 0.0.2"
                    
#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 Sqiddler.Core@0.0.2
                    
#: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=Sqiddler.Core&version=0.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Sqiddler.Core&version=0.0.2
                    
Install as a Cake Tool

Sqiddler

Sqiddler applies Sqids to serialize integer ids to obfuscated strings. It uses ASP.NET Core's built-in JSON serialization and model binding features to automatically convert between integers and Sqid-strings. It also shuffles the alphabet by entity to make it harder to mix ids.

Getting Started

Install NuGet package Sqiddler

dotnet add package Sqiddler

Annotate your id properties with [JsonSqid<TEntity>] and id route parameters with SqidParam<TEntity> to serialize them to Sqid-strings.

public class Person
{
  public int Id { get; set; }
}

public class PersonDto
{
  // Id gets serialized to Sqid-string
  [JsonSqid<Person>]
  public int Id { get; set; }

  public string OtherProperty { get; set; }
}

public class PersonEndpoints
{
  public void Map(WebApplication app)
  {
    app.MapGet("person/{id}", GetPerson);
  }

  public static async Task<Ok<MyDto>> GetPerson(ISender sender, SqidParam<Person> id)
  {
    return Task.FromResult(new PersonDto()
    {
      Id = 42,
      OtherProperty = "Hello, World!"
    }
  }
}

Configuration

Configure Sqids in Program.cs

var builder = WebApplication.CreateBuilder(args);

// configure SqidsOptions from appsettings.json
builder.Configuration.GetSection("Sqids").Bind(SqidsOptionsFactory.Default);

// optimize SqidsOptions.MinLength for TEntity
SqidsOptionsFactory.Configure<Person>(4); // enough for 100_000

var app = builder.Build();
app.Run();

Configure Sqids.SqidsOptions in appsettings.json

"Sqids": {
  // generated from https://sqids.org/playground
  "Alphabet": "kBZDsjNeIWrQUSqExvwgdcnyl05X2F7f3pYVO9MaRhtLoP8GbiuzCm1T6KAJH4"
}

Open API

Install NuGet package Sqiddler.OpenApi instead of Sqiddler

dotnet add package Sqiddler.OpenApi

Register Open API in Program.cs

var builder = WebApplication.CreateBuilder(args);
services.AddOpenApi(options =>
{
  // reflect Sqid-string changes in Open API
  options.AddSqids(options);
});
var app = builder.Build();
app.MapOpenApi();
app.Run();
Product Compatible and additional computed target framework versions.
.NET 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Sqiddler.Core:

Package Downloads
Sqiddler

Use Sqids in ASP.NET Core with Attributes

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.4 256 11/25/2025
0.0.3 236 10/21/2025
0.0.2 251 10/2/2025
0.0.1 236 10/2/2025