DynamoMapper 1.0.6.30
dotnet add package DynamoMapper --version 1.0.6.30
NuGet\Install-Package DynamoMapper -Version 1.0.6.30
<PackageReference Include="DynamoMapper" Version="1.0.6.30" />
<PackageVersion Include="DynamoMapper" Version="1.0.6.30" />
<PackageReference Include="DynamoMapper" />
paket add DynamoMapper --version 1.0.6.30
#r "nuget: DynamoMapper, 1.0.6.30"
#:package DynamoMapper@1.0.6.30
#addin nuget:?package=DynamoMapper&version=1.0.6.30
#tool nuget:?package=DynamoMapper&version=1.0.6.30
DynamoMapper
High-performance source generator for DynamoDB attribute mapping
DynamoMapper is a .NET incremental source generator that generates high-performance mapping code between domain models and Amazon DynamoDB AttributeValue dictionaries. Using compile-time code generation, it eliminates runtime reflection, reduces allocations, and provides type-safe mapping for single-table DynamoDB patterns.
Why DynamoMapper?
- β‘ Zero reflection overhead - All mapping code generated at compile time
- π― Type-safe - Catches configuration errors at compile time with diagnostics
- π Allocation-free - Uses efficient dictionary operations, no LINQ or unnecessary allocations
- π§ Simple - Convention-first with minimal attribute configuration
- π Single-table friendly - Designed for single-table DynamoDB patterns with customization hooks
- π¦ Clean domain models - No attributes on your domain classes required
Installation
Install the NuGet package:
dotnet add package DynamoMapper --prerelease
Install the DynamoMapper agent skill:
npx skills add https://github.com/LayeredCraft/dynamo-mapper --skill dynamo-mapper
Ensure your project uses C# 11 or later:
<PropertyGroup>
<LangVersion>11</LangVersion>
</PropertyGroup>
Quick Start
1. Define your domain model
public class Product
{
public string UserId { get; set; }
public Guid ProductId { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
public string? Description { get; set; }
public ProductStatus Status { get; set; }
}
2. Create a mapper class
using DynamoMapper.Runtime;
using Amazon.DynamoDBv2.Model;
namespace MyApp.Data;
[DynamoMapper(Convention = DynamoNamingConvention.CamelCase)]
[DynamoField(nameof(Product.Description), OmitIfNull = true, OmitIfEmptyString = true)]
public static partial class ProductMapper
{
public static partial Dictionary<string, AttributeValue> ToItem(Product source);
public static partial Product FromItem(Dictionary<string, AttributeValue> item);
}
3. That's it!
At compile time, DynamoMapper generates the mapping code. Use it like this:
var product = new Product
{
UserId = "user-123",
ProductId = Guid.NewGuid(),
Name = "Laptop",
Price = 999.99m,
Status = ProductStatus.Available
};
// Convert to DynamoDB item
var item = ProductMapper.ToItem(product);
await dynamoDbClient.PutItemAsync(new PutItemRequest
{
TableName = "MyTable",
Item = item
});
// Convert from DynamoDB item
var getResponse = await dynamoDbClient.GetItemAsync(new GetItemRequest
{
TableName = "MyTable",
Key = new Dictionary<string, AttributeValue>
{
["pk"] = new AttributeValue { S = $"USER#{product.UserId}" },
["sk"] = new AttributeValue { S = $"PRODUCT#{product.ProductId}" }
}
});
var retrievedProduct = ProductMapper.FromItem(getResponse.Item);
For more examples including single-table patterns and custom converters, see the Quick Start Guide.
Key Features
- Attribute-Based Configuration (Phase 1): Configure mapping via
[DynamoField]and[DynamoIgnore]on mapper classes - Fluent DSL Configuration (Phase 2): Optional strongly-typed DSL for configuration
- Naming Conventions: CamelCase, SnakeCase, or Exact field naming
- Required Field Validation: Compile-time and runtime validation of required fields
- Omission Policies: Flexible null/empty value omission strategies
- Custom Converters: Type-safe converter pattern for custom serialization
- Customization Hooks: Before/After hooks for injecting pk/sk and custom logic
- Single-Table Support: Built for single-table DynamoDB design patterns
- Supported Types: strings, numerics, bool, Guid, DateTime, DateTimeOffset, TimeSpan, enums, plus lists/maps/sets of supported element types
- Comprehensive Diagnostics: Clear compile-time errors with actionable messages
- Zero Configuration: Sensible defaults for most use cases
Learn more in the Core Concepts documentation.
Requirements
- C# 11+ (for partial method generation)
- .NET Standard 2.0+ (package targets)
- AWSSDK.DynamoDBv2 (for AttributeValue types)
See the Requirements page for full details.
Documentation
π Full Documentation - Comprehensive guides and API reference
Key sections:
- Installation - Get started with DynamoMapper
- Quick Start - Your first mapper in 5 minutes
- Core Concepts - Understand how it works
- Usage Guide - Detailed usage patterns
- Examples - Real-world DynamoDB scenarios
- Roadmap - Phase 1 and Phase 2 plans
For AI tooling, install the repo skill with:
npx skills add https://github.com/LayeredCraft/dynamo-mapper --skill dynamo-mapper
Contributing
Contributions are welcome! See our Contributing Guide for details.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Made with β‘ by the LayeredCraft team
Contributors β¨
Thanks goes to these wonderful people (emoji key):
<table> <tbody> <tr> <td align="center" valign="top" width="14.28%"><a href="https://github.com/j-d-ha"><img src="https://avatars.githubusercontent.com/u/61319894?v=4?s=100" width="100px;" alt="Jonas Ha"/><br /><sub><b>Jonas Ha</b></sub></a><br /><a href="https://github.com/LayeredCraft/dynamo-mapper/commits?author=j-d-ha" title="Code">π»</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/ncipollina"><img src="https://avatars.githubusercontent.com/u/1405469?v=4?s=100" width="100px;" alt="Nick Cipollina"/><br /><sub><b>Nick Cipollina</b></sub></a><br /><a href="https://github.com/LayeredCraft/dynamo-mapper/commits?author=ncipollina" title="Code">π»</a></td> </tr> </tbody> </table>
This project follows the all-contributors specification. Contributions of any kind welcome!
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Scriban (>= 7.0.0)
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 |
|---|---|---|
| 1.0.6.30 | 120 | 3/23/2026 |
| 1.0.5.29 | 80 | 3/21/2026 |
| 1.0.5.28 | 81 | 3/19/2026 |
| 1.0.5.27 | 232 | 3/6/2026 |
| 1.0.4.26 | 84 | 3/6/2026 |
| 1.0.4.25 | 228 | 2/18/2026 |
| 1.0.3.24 | 155 | 2/11/2026 |
| 1.0.2.23 | 118 | 2/9/2026 |
| 1.0.1.22 | 197 | 1/23/2026 |
| 1.0.1.21 | 96 | 1/23/2026 |
| 1.0.0.20 | 102 | 1/21/2026 |
| 1.0.0-beta.19 | 53 | 1/21/2026 |
| 1.0.0-beta.18 | 57 | 1/19/2026 |
| 1.0.0-beta.17 | 69 | 1/17/2026 |
| 1.0.0-beta.16 | 47 | 1/16/2026 |
| 1.0.0-beta.15 | 52 | 1/16/2026 |
| 1.0.0-beta.14 | 51 | 1/16/2026 |
| 1.0.0-beta.13 | 56 | 1/16/2026 |
| 0.1.0-alpha.12 | 57 | 1/16/2026 |
| 0.1.0-alpha.11 | 58 | 1/16/2026 |