Database Reference
In-Depth Information
Using the AWS SDK for .NET
As we saw in table operations, a similar SDK is available in .NET as well. The following
are some examples to show how to perform item operations using the .NET API:
Put item
To invoke the putItem method from DynamoDB client, we first need to create a put item
request, as shown in the following code:
var request = new PutItemRequest
{
TableName = "Book",
Item = new Dictionary<string, AttributeValue>()
{
{ "bookId", new AttributeValue { N = "2001" }},
{ "name", new AttributeValue { S = "AWS DynamoDB"
}},
{ "isbn", new AttributeValue { S = "2222-222-222"
}},
{
"authors",
new AttributeValue
{ SS = new List<string>{"XYZ", "PQR"} }
}
}
};
dynamodbClient.PutItem(request);
Get item
To retrieve a particular item from a given table, you just need to simply mention its key, as
shown in the following code:
var request = new GetItemRequest
{
TableName = "Book",
Key = new Dictionary<string,AttributeValue>() { {
"bookId", new AttributeValue { N = "2001" } } },
Search WWH ::




Custom Search