IdemShield.Redis 0.2.0

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

IdemShield.NET

CI .NET 8 .NET 10 License: MIT

Reliable idempotency middleware for ASP.NET Core. IdemShield lets clients safely retry POST, PUT, and PATCH requests without repeating completed side effects.

Release status: 0.2.0 public preview. The packages are published on NuGet and validated for .NET 8 and .NET 10. The API and persistence contract may still evolve before 1.0.0.

Packages

Package Version Purpose
IdemShield.AspNetCore NuGet Middleware, configuration, and storage abstractions
IdemShield.Redis NuGet Distributed Redis-backed store with native record expiry
IdemShield.SqlServer NuGet SQL Server store with coordinated background expiry cleanup

All packages target .NET 8 and .NET 10 and include symbols, XML documentation, the license expression, repository metadata, and this README. Provider packages require the matching core package version.

Install

Install the ASP.NET Core package and one provider:

dotnet add package IdemShield.AspNetCore --version 0.2.0
dotnet add package IdemShield.SqlServer --version 0.2.0

For Redis, replace the second command with:

dotnet add package IdemShield.Redis --version 0.2.0

60-second setup

Register the middleware and a store before building the application:

using IdemShield.AspNetCore;
using IdemShield.SqlServer;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddIdempotency();
builder.Services.UseSqlServerStore(
    builder.Configuration.GetConnectionString("IdemShield")!);

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

app.MapPost("/orders", () => Results.Created("/orders/42", new { orderId = 42 }));
app.Run();

Clients retry with the same idempotency key:

POST /orders HTTP/1.1
Idempotency-Key: order-2026-00042
Content-Type: application/json

{"productName":"book"}

The first completed response is stored. A later request with the same key and request fingerprint receives the stored response without invoking the endpoint again.

Provider setup

Redis

using IdemShield.Redis;

builder.Services.UseRedisStore(
    builder.Configuration.GetConnectionString("Redis")!);

Redis applies each record's expiry as a native key TTL.

SQL Server

using IdemShield.SqlServer;

builder.Services.UseSqlServerStore(connectionString, options =>
{
    options.CleanupInterval = TimeSpan.FromMinutes(30);
    options.CleanupBatchSize = 500;
});

SQL Server creates the IdempotencyRecords table by default. Disable automatic creation when schema changes are DBA-managed:

builder.Services.UseSqlServerStore(connectionString, options =>
{
    options.AutoCreateSchema = false;
});

The cleanup worker runs immediately and then at the configured interval. Multiple application instances coordinate through a SQL Server application lock so only one instance performs a cleanup batch at a time.

Behavioral contract

  • Only POST, PUT, and PATCH requests containing the configured header are intercepted.
  • Keys must contain 1–255 characters after optional application-defined scoping.
  • Reusing a key with a different HTTP method, path, query string, or body returns 422 Unprocessable Entity.
  • An in-progress request returns 409 Conflict by default, or can poll for the completed result.
  • If endpoint execution throws, the in-progress record is removed so a later retry can run.
  • Completed responses replay the status code, body, content type, and safe application headers.
  • Cookie, authentication, server-generated, content-length, and hop-by-hop headers are never persisted for replay.
  • The default record lifetime is 24 hours.

Scope keys for tenant-aware or user-aware APIs:

builder.Services.AddIdempotency(options =>
{
    options.KeySelector = (context, clientKey) =>
        $"{context.User.FindFirst("tenant_id")?.Value}:{clientKey}";
});

Operational considerations

  • IdemShield buffers request and response bodies in memory and replays response bodies as UTF-8 text. Set application-level size limits and do not use it for binary or streaming responses.
  • Do not place secrets or personal data directly in idempotency keys.
  • SQL automatic schema creation requires DDL permission during application startup. Disable it where deployment tooling owns schema changes.
  • Store availability is part of the request path. Apply normal Redis or SQL Server resilience, monitoring, and capacity practices.
  • Idempotency prevents duplicate execution only for requests routed through this middleware and sharing the same backing store and key scope.
  • The endpoint's business transaction and the IdemShield record are not one atomic transaction. Applications requiring that guarantee must design an application-level transactional boundary.

See the focused documentation:

Project health

Every push and pull request builds the solution in Release mode, runs unit and real-provider integration tests, creates all three NuGet packages, validates package contents and public API compatibility, audits dependencies, validates documentation links, and compiles clean .NET 8 and .NET 10 consumer applications from the generated packages.

Security reports should follow SECURITY.md. For support and compatibility expectations, see SUPPORT.md.

Contributing

Contributions are welcome. Read CONTRIBUTING.md and the Code of Conduct before opening a pull request.

License

IdemShield.NET is licensed under the MIT License.

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 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 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
0.2.0 103 8/9/2026
0.1.0 149 8/8/2026

IdemShield 0.2.0 adds .NET 10 support, exact package-family dependencies, runtime and SQL startup hardening, expanded provider integration coverage, and stronger package validation. See CHANGELOG.md for details.