DynamoDBv2.Transactions 4.0.14.102

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

DynamoDBv2.Transactions

A high-performance .NET library for Amazon DynamoDB transactions with compile-time source generation — up to 82x faster than reflection-based mapping.

<p align="center">

CI Auto-Release codecov NuGet NuGet Downloads License: MIT

</p>

<p align="center">

Unit Tests Integration Tests Source Generator Tests Benchmarks

</p>

<p align="center">

.NET 8 .NET 9 .NET 10 AWS SDK v4 Source Link Deterministic

</p>


Why This Library?

DynamoDBv2.Transactions skips the implicit DescribeTable call that the standard AWS SDK wrapper makes, using DynamoDB attributes directly instead. Combined with the source generator, this delivers dramatically faster performance:

<table> <tr> <td width="50%">

Source Generator vs Reflection

Operation Speedup
GetTableName 82x faster
MapToAttribute (15 props) 4.1x faster
GetHashKeyAttributeName 2.1x faster
GetPropertyAttributedName 1.9x faster
GetVersion 1.3x faster

</td> <td width="50%">

End-to-End vs Standard SDK Wrapper

Operation This Library Standard Speedup
1-item write 12.0 ms 15.8 ms 1.3x
3-item write 13.4 ms 46.4 ms 3.5x
3-item alloc 115 KB 251 KB 2.2x less

</td> </tr> </table>

All key lookups are zero-allocation via compile-time switch expressions. Just make your entity class partial — no other changes needed.


Installation

dotnet add package DynamoDBv2.Transactions

Quick Start

1. Define Your Entity

Make it partial and the source generator handles the rest — zero configuration:

[DynamoDBTable("MyTable")]
public partial class MyEntity : ITransactional
{
    [DynamoDBHashKey("PK")]
    public string Id { get; set; }

    [DynamoDBProperty("Name")]
    public string Name { get; set; }

    [DynamoDBVersion]
    public long? Version { get; set; }
}

The generator auto-discovers all partial classes with [DynamoDBHashKey] and registers them at startup via [ModuleInitializer]. Non-partial classes fall back to cached reflection seamlessly.

2. Perform a Transaction

using DynamoDBv2.Transactions;

var client = new AmazonDynamoDBClient();

await using (var transactor = new DynamoDbTransactor(client))
{
    transactor.CreateOrUpdate(new MyEntity
    {
        Id = "user-123",
        Name = "Alice"
    });
}

Features

  • AWS SDK v4: Built for AWSSDK.DynamoDBv2 v4.x
  • Source Generator: Compile-time DynamoDB attribute mapping — zero reflection for partial classes
  • Transactional Operations: CreateOrUpdate, Delete, Update, Patch, ConditionCheck
  • 100-Item Limit Validation: Enforces DynamoDB's limit before sending the request
  • TransactionOptions: ClientRequestToken, ReturnConsumedCapacity, ReturnItemCollectionMetrics
  • Versioning: Automatic version increment handling for optimistic concurrency
  • Async API: Fully asynchronous
  • Multi-targeting: .NET 8.0, .NET 9.0, and .NET 10.0

Usage Examples

Deleting an Item

await using (var transactor = new DynamoDbTransactor(client))
{
    transactor.DeleteAsync<TestTable>(userIdToDelete);
}

Patching a Property

await using (var transactor = new DynamoDbTransactor(client))
{
    transactor.PatchAsync<TestTable, DateTime?>(userId, t => t.SomeNullableDate1, updatedDate);
}

Conditional Check + Update

await using (var transactor = new DynamoDbTransactor(client))
{
    transactor.ConditionGreaterThan<TestTable, int>(userId, t => t.SomeInt, 100);
    transactor.CreateOrUpdate(new TestTable { UserId = userId, SomeInt = 200 });
}

Complex Multi-Operation Transaction

await using (var transactor = new DynamoDbTransactor(client))
{
    transactor.ConditionNotEquals<TestTable, bool>(userId, t => t.SomeBool, false);
    transactor.CreateOrUpdate(testItem);
    transactor.PatchAsync<TestTable, int>(userId, t => t.SomeInt, 200);
}

Version Check Before Update

await using (var transactor = new DynamoDbTransactor(client))
{
    transactor.ConditionVersionEquals<TestTable>(userId, t => t.Version, expectedVersion);
    transactor.CreateOrUpdate(new TestTable { UserId = userId, SomeInt = 250 });
}

Using TransactionOptions

await using (var transactor = new DynamoDbTransactor(client))
{
    transactor.Options = new TransactionOptions
    {
        ClientRequestToken = "idempotency-token-123",
        ReturnConsumedCapacity = ReturnConsumedCapacity.TOTAL
    };

    transactor.CreateOrUpdate(item1);
    transactor.CreateOrUpdate(item2);
}

Detailed Benchmark Results

Mapper Performance: Source-Generated vs Reflection

Isolated mapping operations — no DynamoDB I/O. Entity with 15 properties including all common types. Reflection results use warmed-up ConcurrentDictionary caches (best-case reflection).

BenchmarkDotNet v0.15.8, Linux Ubuntu 25.10
.NET SDK 9.0.311, .NET 9.0.13, X64 RyuJIT x86-64-v3

Runtime=.NET 9.0  IterationCount=20  LaunchCount=3  WarmupCount=5
Method Mean Allocated vs Reflection
MapToAttribute (source-generated) 4,048.56 ns 3232 B 4.1x faster
MapToAttribute (reflection) 16,412.42 ns 4000 B baseline
GetPropertyAttributedName (source-gen) 20.74 ns 0 B 1.9x faster
GetPropertyAttributedName (reflection) 39.38 ns 0 B baseline
GetHashKeyAttributeName (source-gen) 14.43 ns 0 B 2.1x faster
GetHashKeyAttributeName (reflection) 30.49 ns 0 B baseline
GetVersion (source-generated) 144.75 ns 56 B 1.3x faster
GetVersion (reflection) 192.52 ns 56 B baseline
GetTableName (source-generated) 13.87 ns 0 B 82x faster
GetTableName (reflection) 1,135.12 ns 144 B baseline

End-to-End Transaction Performance

Full transactional writes against DynamoDB (includes network I/O via localstack).

BenchmarkDotNet v0.13.12, Windows 11
AMD Ryzen 9 6900HS, .NET 8.0.2

Job=OutOfProc  IterationCount=15  LaunchCount=3  WarmupCount=10
Method Mean Error StdDev Allocated
DynamoDbTransactionsWrapper 11.99 ms 0.046 ms 0.087 ms 80.96 KB
OriginalWrapper 15.83 ms 0.236 ms 0.442 ms 83.77 KB
DynamoDbTransactionsWrapper3Items 13.37 ms 0.066 ms 0.123 ms 114.74 KB
OriginalWrapper3Items 46.44 ms 0.444 ms 0.834 ms 251.01 KB

Running Benchmarks

dotnet run --project test/DynamoDBv2.Transactions.Benchmarks -c Release -- --filter '*MapperBenchmark*'
dotnet run --project test/DynamoDBv2.Transactions.Benchmarks -c Release -- --filter '*Benchmark*'

Running Tests

Integration tests run via Docker Compose with localstack:

docker-compose up --exit-code-from tests tests localstack
docker-compose up --exit-code-from unittests unittests

Versioning

This library's version tracks the underlying AWSSDK.DynamoDBv2 version:

Format: {aws_major}.{aws_minor}.{aws_patch}.{aws_rev × 100 + lib_rev}
AWS SDK Version Library Release Meaning
4.0.14.1 4.0.14.100 Initial release for AWS SDK 4.0.14.1
4.0.14.1 4.0.14.101 Library-only fix (same AWS SDK)
4.0.15.0 4.0.15.0 New AWS SDK version, lib rev 0

The first three segments always tell you which AWS SDK version is inside.

Contributing

When creating PRs, please ensure:

  • No sensitive information (tokens, keys, credentials) is included
  • All existing tests pass (docker-compose up --exit-code-from tests tests localstack)
  • New features include appropriate test coverage

License

Copyright © 2026, Vitali Bibikov. Code released under the MIT license.

Contact

Vitali Bibikov — bibikovvitaly@gmail.com

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 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.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

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
4.0.14.109 2,215 4/9/2026
4.0.14.108 115 4/9/2026
4.0.14.107 163 4/9/2026
4.0.14.106 922 3/10/2026
4.0.14.105 104 3/9/2026
4.0.14.104 101 3/9/2026
4.0.14.103 101 3/9/2026
4.0.14.102 98 3/9/2026
4.0.14.101 103 3/9/2026
4.0.14.100 102 3/9/2026
4.0.14.1 108 3/9/2026
3.7.407 102 3/8/2026
3.7.406.3 313 3/20/2025
Loading failed