Amazon DynamoDB
开发人员指南 (API 版本 2012-08-10)
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 Amazon AWS 入门

步骤 10:删除 Movies 表

Microsoft .NET 和 DynamoDB 教程的本步骤中,您将在 Amazon DynamoDB 中删除一个 Movies 表。

DynamoDB_intro 中的 Main 函数将等待 DeletingTable_async,DeletingTable_async 在 10_DeletingTable.cs 文件中实施:

using System; using System.Threading.Tasks; namespace DynamoDB_intro { public static partial class Ddb_Intro { /*-------------------------------------------------------------------------- * DeletingTable_async *--------------------------------------------------------------------------*/ public static async Task<bool> DeletingTable_async( string tableName ) { operationSucceeded = false; operationFailed = false; Console.WriteLine( " -- Trying to delete the table named \"{0}\"...", tableName ); pause( ); Task tblDelete = client.DeleteTableAsync( tableName ); try { await tblDelete; } catch( Exception ex ) { Console.WriteLine( " ERROR: Failed to delete the table, because:\n " + ex.Message ); operationFailed = true; return ( false ); } Console.WriteLine( " -- Successfully deleted the table!" ); operationSucceeded = true; pause( ); return ( true ); } } }

DeletingTable_async 等待低级别 DynamoDB 方法 AmazonDynamoDBClient.DeleteTableAsync 删除表。

了解更多信息

本页内容: