Skip to content

Ensono/stacks-dotnet-packages-dynamodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stacks-dotnet-packages-dynamodb

A thin layer on top of the AWS SDK for .NET using the Object Persistence Model.

Requirements

You need a DynamoDB instance in order to use this library. You can follow the official instructions provided by AWS here.

It should be noted that the object(s) from your application that you want to store in DynamoDB have to conform to the Object Persistence Model.

Configuration

Relevant documentation pages that you can follow to set up your profile:

This library assumes you'll use the AWS CLI tools and will have configured your access keys via the aws configure command.

Usage

Using the library is simple. You have to call the AddDynamoDb() service collection extension method and inject the configuraiton in the project where you want to connect to DynamoDB.

services.Configure<DynamoDbConfiguration>(context.Configuration.GetSection("DynamoDb"));
services.AddDynamoDB();

The configuration will be read from the DynamoDb section located in the appsettings.json file

"DynamoDb": {
    "TableName": "Menu",
    "TablePrefix": ""
}

This will give you access to the IDynamoDbObjectStorage which you'll use to perform CRUD operations with in DynamoDB.

This will also give you access to the IDynamoDbObjectSearch which you'll use to perform any Scan / Query operations with in DynamoDB.

Data Converters

The package provides a converter from Guid to string since DynamoDb doesn't understand UUID's. The DynamoDbGuidConverter can be found in the Amido.Stacks.DynamoDB.Converters namespace.

[DynamoDBProperty(typeof(DynamoDbGuidConverter))]
public Guid Id { get; private set; }

To map your own types you can create your own converters. Documentation on how to do that can be found here.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages