User guide
• Using Expressions with DynamoDB (p. 52)
• JSON Support in Amazon DynamoDB (p. 63)
• Managing ASP.NET Session State with Amazon DynamoDB (p. 65)
Programming Models
The SDK for .NET provides three different programming models for communicating with DynamoDB.
These programming models include the low-level model, the document model, and the object persistence
model. The following information describes these models, how to use them, and when you might want
to use them.
Topics
• Low-Level (p. 47)
• Document (p. 50)
• Object Persistence (p. 51)
Low-Level
The low-level programming model wraps direct calls to the DynamoDB service.You access this model
through the Amazon.DynamoDBv2 namespace.
Of the three models, the low-level model requires you to write the most code. For example, you must
convert .NET data types to their equivalents in DynamoDB. However, this model gives you access to the
most features.
The following example shows how to use the low-level model to create a table in DynamoDB:
// using Amazon.DynamoDBv2;
// using Amazon.DynamoDBv2.Model;
var client = new AmazonDynamoDBClient();
var request = new CreateTableRequest
{
TableName = "AnimalsInventory",
AttributeDefinitions = new List<AttributeDefinition>
{
new AttributeDefinition
{
AttributeName = "Id",
// "S" = string, "N" = number, and so on.
AttributeType = "N"
},
new AttributeDefinition
{
AttributeName = "Type",
AttributeType = "S"
}
},
KeySchema = new List<KeySchemaElement>
{
new KeySchemaElement
{
AttributeName = "Id",
Version v2.0.0
47
AWS SDK for .NET Developer Guide
Programming Models