Amazon AWS SDK Guía de usuario Pagina 53

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 155
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 52
}
} while (status != TableStatus.ACTIVE);
In the preceding example, the target table to check is referenced through the AmazonDynamoDBClient
class's DescribeTable method. Every 5 seconds, the code checks the value of the table's TableStatus
property. When the status is set to ACTIVE, then the table is ready to be modified.
The following example shows how to use the low-level model to insert two items into a table in DynamoDB:
// using Amazon.DynamoDBv2;
// using Amazon.DynamoDBv2.Model;
var client = new AmazonDynamoDBClient();
var request1 = new PutItemRequest
{
TableName = "AnimalsInventory",
Item = new Dictionary<string, AttributeValue>
{
{ "Id", new AttributeValue { N = "1" }},
{ "Type", new AttributeValue { S = "Dog" }},
{ "Name", new AttributeValue { S = "Fido" }}
}
};
var request2 = new PutItemRequest
{
TableName = "AnimalsInventory",
Item = new Dictionary<string, AttributeValue>
{
{ "Id", new AttributeValue { N = "2" }},
{ "Type", new AttributeValue { S = "Cat" }},
{ "Name", new AttributeValue { S = "Patches" }}
}
};
client.PutItem(request1);
client.PutItem(request2);
In the preceding example, each item is inserted through the AmazonDynamoDBClient class's PutItem
method, using an instance of the PutItemRequest class. Each of the two instances of the
PutItemRequest class takes the name of the table to be inserted into, along with a series of item attribute
values.
For more information and examples, see:
Working with Tables Using the AWS SDK for .NET Low-Level API
Working with Items Using the AWS SDK for .NET Low-Level API
Querying Tables Using the AWS SDK for .NET Low-Level API
Scanning Tables Using the AWS SDK for .NET Low-Level API
Working with Local Secondary Indexes Using the AWS SDK for .NET Low-Level API
Working with Global Secondary Indexes Using the AWS SDK for .NET Low-Level API
Version v2.0.0
49
AWS SDK for .NET Developer Guide
Programming Models
Vista de pagina 52
1 2 ... 48 49 50 51 52 53 54 55 56 57 58 ... 154 155

Comentarios a estos manuales

Sin comentarios