amazon-dynamodb Using AWS DynamoDb with the AWS .NET SDK


Amazon DynamoDB is a fast NoSQL database service offered by Amazon Web Services (AWS). DynamoDB can be invoked from .NET applications by using the AWS SDK for .NET. The SDK provides three different models for communicating with DynamoDB. This topic is introduces the various APIs in each model.

The Models

The SDK provides three ways of communicating with DynamoDB. Each one offers tradeoffs between control and ease of use. See the AWS .NET SDK Reference for details on the APIs below.

  • Low-level: Amazon.DynamoDBv2 namespace — This is a thin wrapper over the DynamoDB service calls. It matches all the service features. You can reference the service documentation to learn more about each individual operation.

  • Document Model: Amazon.DynamoDBv2.DocumentModel namespace — This is a model that provides a simpler interface for dealing with data. DynamoDB tables are represented by Table objects, while individual rows of data are represented by Document objects. Conversion of .NET objects to DynamoDB data is automatic for basic types.

  • Object Persistence Model: Amazon.DynamoDBv2.DataModel namespace — This set of APIs allow you to store and load .NET objects in DynamoDB. Objects must be marked up to configure the target table and the hash/range keys. DynamoDBContext acts on marked up objects. It is used to store and load DynamoDB data, or to retrieve .NET objects from a query or scan operation. Basic data types are automatically converted to DynamoDB data and converters allow arbitrary types to be stored in DynamoDB.

The three models provide different approaches to working with the service. While the low-level approach requires more client-side code — the user must convert .NET types such as numbers and dates to DynamoDB-supported strings — it provides access to all service features. By comparison, the Object Persistence Model approach makes it easier to use the service—since the user is for the most part working with familiar .NET objects—but does not provide all the functionality. For example, it is not possible to make conditional Put calls with the Object Persistence Model.

Learn more about working AWS using the .NET SDK in the .NET SDK Developer Guide.

Note: This topic was adapted with permission from a blog post originally published on the AWS .NET SDK blog.