• <small id='h5nWm'></small><noframes id='h5nWm'>

    <i id='h5nWm'><tr id='h5nWm'><dt id='h5nWm'><q id='h5nWm'><span id='h5nWm'><b id='h5nWm'><form id='h5nWm'><ins id='h5nWm'></ins><ul id='h5nWm'></ul><sub id='h5nWm'></sub></form><legend id='h5nWm'></legend><bdo id='h5nWm'><pre id='h5nWm'><center id='h5nWm'></center></pre></bdo></b><th id='h5nWm'></th></span></q></dt></tr></i><div id='h5nWm'><tfoot id='h5nWm'></tfoot><dl id='h5nWm'><fieldset id='h5nWm'></fieldset></dl></div>

      <tfoot id='h5nWm'></tfoot>

      • <bdo id='h5nWm'></bdo><ul id='h5nWm'></ul>
      <legend id='h5nWm'><style id='h5nWm'><dir id='h5nWm'><q id='h5nWm'></q></dir></style></legend>

        DynamoDB .NET - 从表中删除所有项目

        时间:2023-09-14
          <bdo id='mzyHd'></bdo><ul id='mzyHd'></ul>
            <tfoot id='mzyHd'></tfoot>

            <small id='mzyHd'></small><noframes id='mzyHd'>

              <tbody id='mzyHd'></tbody>
            <legend id='mzyHd'><style id='mzyHd'><dir id='mzyHd'><q id='mzyHd'></q></dir></style></legend>

                1. <i id='mzyHd'><tr id='mzyHd'><dt id='mzyHd'><q id='mzyHd'><span id='mzyHd'><b id='mzyHd'><form id='mzyHd'><ins id='mzyHd'></ins><ul id='mzyHd'></ul><sub id='mzyHd'></sub></form><legend id='mzyHd'></legend><bdo id='mzyHd'><pre id='mzyHd'><center id='mzyHd'></center></pre></bdo></b><th id='mzyHd'></th></span></q></dt></tr></i><div id='mzyHd'><tfoot id='mzyHd'></tfoot><dl id='mzyHd'><fieldset id='mzyHd'></fieldset></dl></div>

                  本文介绍了DynamoDB .NET - 从表中删除所有项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在学习如何使用 DynamoDB for .net,但我有疑问,是否有正确的方法从现有表中删除所有项目?我的意思是,我不想删除表,只是清空它.我读过批处理,但它们对我帮助不大.

                  I'm learning how to work with DynamoDB for .net and I have a doubt, Is there a correct way to delete all items from an existing table?, I mean, I don't want to delete the table, just empty it. I've read about batch process but they don't help me much.

                  我有这个

                  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;
                      }
                  

                  当然,这只会删除与值a"匹配的 id.

                  But of course, that only delete the id that match with the value "a".

                  谢谢.

                  推荐答案

                  我建议您删除表并重新创建它.来自 DynamoDB 使用表的指南 文档:

                  I would recommend that you just delete the table and recreate it. From the DynamoDB Guidelines for Working with Tables documentation:

                  ...

                  删除整个表比删除更有效一个接一个的项目,这实际上使写入吞吐量翻了一番您执行的删除操作与放置操作一样多.

                  Deleting an entire table is significantly more efficient than removing items one-by-one, which essentially doubles the write throughput as you do as many delete operations as put operations.

                  这篇关于DynamoDB .NET - 从表中删除所有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在 Selenium C# 中切换 Chrome 上的选项卡? 下一篇:Net Core 2.0 AmazonServiceException:找不到凭证

                  相关文章

                      <bdo id='TWQjp'></bdo><ul id='TWQjp'></ul>
                    1. <small id='TWQjp'></small><noframes id='TWQjp'>

                      <legend id='TWQjp'><style id='TWQjp'><dir id='TWQjp'><q id='TWQjp'></q></dir></style></legend>
                    2. <tfoot id='TWQjp'></tfoot>

                    3. <i id='TWQjp'><tr id='TWQjp'><dt id='TWQjp'><q id='TWQjp'><span id='TWQjp'><b id='TWQjp'><form id='TWQjp'><ins id='TWQjp'></ins><ul id='TWQjp'></ul><sub id='TWQjp'></sub></form><legend id='TWQjp'></legend><bdo id='TWQjp'><pre id='TWQjp'><center id='TWQjp'></center></pre></bdo></b><th id='TWQjp'></th></span></q></dt></tr></i><div id='TWQjp'><tfoot id='TWQjp'></tfoot><dl id='TWQjp'><fieldset id='TWQjp'></fieldset></dl></div>