Transformations.Dapper
2.0.4.1
See the version list below for details.
dotnet add package Transformations.Dapper --version 2.0.4.1
NuGet\Install-Package Transformations.Dapper -Version 2.0.4.1
<PackageReference Include="Transformations.Dapper" Version="2.0.4.1" />
<PackageVersion Include="Transformations.Dapper" Version="2.0.4.1" />
<PackageReference Include="Transformations.Dapper" />
paket add Transformations.Dapper --version 2.0.4.1
#r "nuget: Transformations.Dapper, 2.0.4.1"
#:package Transformations.Dapper@2.0.4.1
#addin nuget:?package=Transformations.Dapper&version=2.0.4.1
#tool nuget:?package=Transformations.Dapper&version=2.0.4.1
Transformations.Dapper
Resilient Dapper query wrappers with built-in transient SQL fault detection — drop-in replacements for standard Dapper methods that automatically retry on deadlocks, timeouts, and Azure SQL throttling.
📖 Overview
Transformations.Dapper brings the hardened retry semantics of Transformations.Core directly into your Dapper workflows. Cloud databases regularly drop connections or trigger transient deadlocks — this library automatically identifies retriable SQL error codes and re-executes queries transparently.
🚀 Why Transformations.Dapper?
Instead of manually catching SqlException and writing retry loops everywhere, you swap connection.QueryAsync for connection.QueryWithRetryAsync. The built-in transient fault detector handles the backoff strategy. The result is database code that's both cleaner and more resilient — with no extra ceremony.
📦 Install
<PackageReference Include="Transformations.Dapper" Version="2.0.4.1" />
💡 What's Included
Resilient Async Queries
Swap connection.QueryAsync for connection.QueryWithRetryAsync. Transient SQL faults are detected automatically and retried with exponential backoff.
// 3 retries, 500ms initial delay — doubles each attempt
var users = await connection.QueryWithRetryAsync<User>(
"SELECT * FROM Users WHERE Status = @Status",
new { Status = UserStatus.Active },
retryCount: 3,
initialDelay: TimeSpan.FromMilliseconds(500));
// Single row — returns null rather than throwing on no result
var user = await connection.QuerySingleOrDefaultWithRetryAsync<User>(
"SELECT * FROM Users WHERE Id = @Id",
new { Id = userId });
// Execute (INSERT/UPDATE/DELETE) and scalar
int affected = await connection.ExecuteWithRetryAsync(
"DELETE FROM Sessions WHERE ExpiredAt < @Now", new { Now = DateTime.UtcNow });
int count = await connection.ExecuteScalarWithRetryAsync<int>(
"SELECT COUNT(*) FROM Users WHERE Active = 1");
Transient Fault Detection
SqlTransientFaultDetector.IsTransient classifies SQL errors that are safe to retry: deadlocks (1205), timeouts (‑2, 53, 121), Azure throttling (40197, 40501, 40613, 49918), and transport-level errors. Use it in your own catch blocks:
catch (SqlException ex) when (SqlTransientFaultDetector.IsTransient(ex))
{
logger.LogWarning(ex, "Transient SQL fault on attempt {Attempt}", attempt);
}
SqlParameter Bridge
Converts anonymous or POCO objects to SqlParameter[] — useful when bridging legacy SqlCommand code or when you need explicit SqlDbType control that Dapper's anonymous parameters don't offer.
// From an anonymous object
IReadOnlyList<SqlParameter> sqlParams = SqlParameterBridge.ToSqlParameters(
new { UserId = 42, Name = "Alice" });
// With explicit SqlDbType overrides
IReadOnlyList<SqlParameter> sqlParams = SqlParameterBridge.ToSqlParameters(
new { UserId = 42, Bio = longText },
new Dictionary<string, SqlDbType>
{
["Bio"] = SqlDbType.NVarChar
});
// NativeAOT / trimmer-safe generic overload
IReadOnlyList<SqlParameter> sqlParams = SqlParameterBridge.ToSqlParameters<MyParams>(myParams);
🛠 API Reference
| Class | Purpose | Key Members |
|---|---|---|
DapperResilienceExtensions |
Retry-wrapped Dapper | QueryWithRetryAsync<T>, QuerySingleOrDefaultWithRetryAsync<T>, ExecuteWithRetryAsync, ExecuteScalarWithRetryAsync<T> |
SqlTransientFaultDetector |
SQL error classification | IsTransient(SqlException) |
SqlParameterBridge |
Object → SqlParameter[] |
ToSqlParameters(object), ToSqlParameters(object, typeMappings), ToSqlParameters<T>(T) |
📦 Dependencies
Transformations.CoreDapperMicrosoft.Data.SqlClient
License
MIT — Copyright © 2026 opentail.net
| Product | Versions 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 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. |
-
net10.0
- Dapper (>= 2.1.72)
- Microsoft.Data.SqlClient (>= 7.0.0)
- Transformations.Core (>= 2.0.4.1)
-
net8.0
- Dapper (>= 2.1.72)
- Microsoft.Data.SqlClient (>= 7.0.0)
- Transformations.Core (>= 2.0.4.1)
-
net9.0
- Dapper (>= 2.1.72)
- Microsoft.Data.SqlClient (>= 7.0.0)
- Transformations.Core (>= 2.0.4.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Transformations.Dapper:
| Package | Downloads |
|---|---|
|
Transformations
Modern .NET transformation helpers for conversion, strings, collections, data, web, diagnostics, batching, and resilience. |
GitHub repositories
This package is not used by any popular GitHub repositories.