This is an Amazon DynamoDb "One Table" library for dotnet. The goal here is to simplify the "One Table" design approach by using attributed POCO's as the basis for the Key/Attribute schema and providing a native expression basis for Key, Query and Condition expressions.
Requirements:
- You use Microsoft.Extensions.DependencyInjection.IServiceProvider to resolve your services.
- IAmazonDynamoDb must be registered in within IServiceProvider
- .Net Core 6, 7, & 8
First, install the NBasis.OneTable NuGet package into your app.
dotnet add package NBasis.OneTable
Next, add a table context to your project by inheriting from NBasis.OneTable.TableContext
using NBasis.OneTable;
public class DemoTableContext : TableContext
{
}
Then, within your application's setup add the Amazon DynamoDb Client and NBasis.OneTable to your IServiceCollection using the provided extension method and DynamoDb table name.
services.AddSingleton<IAmazonDynamoDB>(new AmazonDynamoDBClient())
.AddOneTable<DemoTableContext>("<table-name>");
The NBasis.OneTable interfaces are now available via IServiceProvider.