ArturRios.Data.DynamoDb
1.0.3
dotnet add package ArturRios.Data.DynamoDb --version 1.0.3
NuGet\Install-Package ArturRios.Data.DynamoDb -Version 1.0.3
<PackageReference Include="ArturRios.Data.DynamoDb" Version="1.0.3" />
<PackageVersion Include="ArturRios.Data.DynamoDb" Version="1.0.3" />
<PackageReference Include="ArturRios.Data.DynamoDb" />
paket add ArturRios.Data.DynamoDb --version 1.0.3
#r "nuget: ArturRios.Data.DynamoDb, 1.0.3"
#:package ArturRios.Data.DynamoDb@1.0.3
#addin nuget:?package=ArturRios.Data.DynamoDb&version=1.0.3
#tool nuget:?package=ArturRios.Data.DynamoDb&version=1.0.3
ArturRios.Data.DynamoDb
An AWS DynamoDB store for the ArturRios.Data toolkit — the same enveloped repository style as
the rest of the family, over the AWS SDK's
object-persistence model.
Every operation returns a DataOutput / ProcessOutput
envelope, so infrastructure failures — including optimistic-concurrency conflicts — surface as errors
on the result instead of unhandled exceptions.
This package is standalone (no relational core) and async-only, matching the DynamoDB SDK.
Installation
dotnet add package ArturRios.Data.DynamoDb
Requires .NET 10.0 or later.
Quick start
1. Define an item POCO using the AWS attributes:
using Amazon.DynamoDBv2.DataModel;
[DynamoDBTable("products")]
public class Product
{
[DynamoDBHashKey] public string Category { get; set; } = string.Empty;
[DynamoDBRangeKey] public string Sku { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public decimal Price { get; set; }
[DynamoDBVersion] public int? Version { get; set; } // optional optimistic concurrency
}
2. Configure (appsettings.json, default section "ArturRios.Data.DynamoDb"):
{
"ArturRios.Data.DynamoDb": {
"Region": "us-east-1"
}
}
For DynamoDB Local or LocalStack, set ServiceUrl instead — dummy credentials are supplied
automatically when you don't pass any:
{
"ArturRios.Data.DynamoDb": {
"ServiceUrl": "http://localhost:8000",
"Region": "us-east-1"
}
}
Leaving both Region and the keys unset defers to the AWS SDK's default resolution chain
(environment, profile, instance metadata) — the usual choice on EC2, ECS, or Lambda.
3. Register (Program.cs):
using ArturRios.Data.DynamoDb.DependencyInjection;
builder.Services.AddDynamoData(builder.Configuration);
There is also an AddDynamoData(DynamoOptions) overload if you'd rather build the options yourself.
4. Inject and use:
using ArturRios.Data.DynamoDb.Interfaces;
using ArturRios.Output;
public class ProductService(IAsyncDynamoRepository<Product> repo)
{
public async Task<Product?> GetAsync(string category, string sku, CancellationToken ct = default)
{
DataOutput<Product?> result = await repo.LoadAsync(category, sku, ct);
return result.Success ? result.Data : null;
}
public async Task<IEnumerable<Product>> InCategoryAsync(string category, CancellationToken ct = default)
{
var result = await repo.QueryAsync(category, ct);
return result.Success ? result.Data : [];
}
}
Repository surface
| Method | Purpose |
|---|---|
SaveAsync(item) |
put (create or replace) an item |
LoadAsync(hashKey) / LoadAsync(hashKey, rangeKey) |
load by key, or a successful null when not found |
DeleteAsync(item) |
delete (idempotent) |
QueryAsync(hashKey) |
all items with a partition key |
QueryAsync(hashKey, op, sortKeyValues) |
partition key plus a sort-key condition |
ScanAsync(conditions) |
full-table scan — use sparingly |
SaveManyAsync / DeleteManyAsync / LoadManyAsync |
batch operations |
All are async and take an optional CancellationToken.
Optimistic concurrency
Add a [DynamoDBVersion] property to opt in. Single-item SaveAsync and DeleteAsync then use a
conditional write, and a concurrent modification returns an error on the envelope.
Batch operations bypass version checks. DynamoDB's batch-write API has no conditional-write support, so
SaveManyAsyncandDeleteManyAsyncdo not enforce[DynamoDBVersion]. Use the single-item methods where concurrency matters.
Documentation
- 📚 Full documentation: https://artur-rios.github.io/dotnet-data
- ⚡ DynamoDB guide: https://artur-rios.github.io/dotnet-data/dynamodb/
- 🧩 Architecture & diagrams: https://artur-rios.github.io/dotnet-data/architecture/
Legal
Licensed under the MIT License.
| Product | Versions 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. |
-
net10.0
- ArturRios.Output (>= 3.1.0)
- AWSSDK.DynamoDBv2 (>= 4.0.101.4)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.