Alp*_*per 2 .net c# dml amazon-dynamodb
我正在学习如何使用DynamoDB for .net而且我有一个疑问,是否有正确的方法从现有表中删除所有项目?我的意思是,我不想删除表,只是清空它.我已经阅读了有关批处理的内容,但它们对我没什么帮助.
我有这个
private string DeleteAllFromTable()
{
string result = string.Empty;
try
{
var request = new BatchWriteItemRequest
{
RequestItems = new Dictionary<string, List<WriteRequest>>
{
{
this.Tablename, new List<WriteRequest>
{
new WriteRequest
{
DeleteRequest = new DeleteRequest
{
Key = new Dictionary<string,AttributeValue>()
{
{ "Id", new AttributeValue { S = "a" } }
}
}
}
}
}
}
};
var response = this.DynamoDBClient.BatchWriteItem(request);
}
catch (AmazonDynamoDBException e)
{
}
return result;
}
Run Code Online (Sandbox Code Playgroud)
但是,当然,只删除与值"a"匹配的id.
谢谢.
| 归档时间: |
|
| 查看次数: |
4124 次 |
| 最近记录: |