Trellis.Asp.Idempotency.Cosmos 3.0.0-alpha.505

This is a prerelease version of Trellis.Asp.Idempotency.Cosmos.
dotnet add package Trellis.Asp.Idempotency.Cosmos --version 3.0.0-alpha.505
                    
NuGet\Install-Package Trellis.Asp.Idempotency.Cosmos -Version 3.0.0-alpha.505
                    
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="Trellis.Asp.Idempotency.Cosmos" Version="3.0.0-alpha.505" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Trellis.Asp.Idempotency.Cosmos" Version="3.0.0-alpha.505" />
                    
Directory.Packages.props
<PackageReference Include="Trellis.Asp.Idempotency.Cosmos" />
                    
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 Trellis.Asp.Idempotency.Cosmos --version 3.0.0-alpha.505
                    
#r "nuget: Trellis.Asp.Idempotency.Cosmos, 3.0.0-alpha.505"
                    
#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 Trellis.Asp.Idempotency.Cosmos@3.0.0-alpha.505
                    
#: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=Trellis.Asp.Idempotency.Cosmos&version=3.0.0-alpha.505&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Trellis.Asp.Idempotency.Cosmos&version=3.0.0-alpha.505&prerelease
                    
Install as a Cake Tool

Trellis.Asp.Idempotency.Cosmos

NuGet Package

Cosmos DB-backed IIdempotencyStore for the Trellis idempotency middleware — safe across instances and process restarts.

Installation

dotnet add package Trellis.Asp.Idempotency.Cosmos

Quick Example

// Provision once at startup: partitioned on /scope, TTL enabled.
var database = (await cosmosClient.CreateDatabaseIfNotExistsAsync("billing")).Database;
await CosmosIdempotencyContainer.CreateIfNotExistsAsync(database);

builder.Services.AddSingleton(cosmosClient);
builder.Services.AddTrellisIdempotency(o => o.MaxResponseBodyBytes = 64 * 1024);
builder.Services.AddCosmosIdempotencyStore("billing");

app.UseTrellisIdempotency();

Why Cosmos DB

Contract requirement Cosmos DB primitive
Atomic reserve CreateItem409 Conflict on duplicate id, decided on the primary replica
Conditional complete / abandon Native ETag IfMatchEtag, no scripting
Expiry Per-item ttl, no sweeper process
No silent eviction Never drops a live entry under memory pressure, unlike a Redis cache under allkeys-lru

Key Features

  • Correct under Session consistency — reservations are granted only by an atomic create or an ETag-conditional replace, never on the strength of a read, so a stale replica cannot cause a double execution. Strong consistency is not required.
  • Expiry enforced in-process — Cosmos DB's TTL sweep is best-effort and can return an item past its ttl, so the store re-checks its own timestamps rather than trusting the service.
  • No exceptions on the hot path — uses the stream APIs, because a 409 is the normal outcome of every replay.
  • Verified, not asserted — passes all 17 rules of the Trellis.Testing.Idempotency conformance suite against a real Cosmos DB emulator.

Documentation

See the API reference for the document model, partitioning and RU-cost guidance, and the concurrency protocol.

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.

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
3.0.0-alpha.505 48 9/13/2026
3.0.0-alpha.495 116 8/24/2026
3.0.0-alpha.458 95 8/19/2026
3.0.0-alpha.455 101 8/19/2026
3.0.0-alpha.449 64 8/18/2026
3.0.0-alpha.447 65 8/18/2026