05_ReadingItem.cs - AWS Code Sample

05_ReadingItem.cs

// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX - License - Identifier: Apache - 2.0 using System; using System.Threading.Tasks; using Amazon.DynamoDBv2.DocumentModel; namespace DynamoDB_intro { public static partial class DdbIntro { public static async Task<Document> ReadingMovie_async(int year, string title) { // Create Primitives for the HASH and RANGE portions of the primary key Primitive hash = new Primitive(year.ToString(), true); Primitive range = new Primitive(title, false); try { var movieItem = await MoviesTable.GetItemAsync(hash, range, Token); return movieItem; } catch (Exception) { return null; } } }

Sample Details

Service: dynamodb

Last tested:

Author: AWS

Type: full-example