Amazon.DynamoDBv2.DocumentModel.Table.GetItemAsync C# (CSharp) Метод

GetItemAsync() публичный Метод

Initiates the asynchronous execution of the GetItem operation.
public GetItemAsync ( DynamoDBEntry>.IDictionary key, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null ) : void
key DynamoDBEntry>.IDictionary Key of the document.
callback AmazonDynamoDBCallback The callback that will be invoked when the asynchronous operation completes.
asyncOptions Amazon.Runtime.AsyncOptions An instance of AsyncOptions that specifies how the async method should be executed.
Результат void
        public void GetItemAsync(IDictionary<string, DynamoDBEntry> key,
            AmazonDynamoDBCallback<Document> callback, AsyncOptions asyncOptions = null)
        {
            asyncOptions = asyncOptions ?? new AsyncOptions();
            DynamoDBAsyncExecutor.ExecuteAsync<Document>(
                () => { return GetItemHelper(MakeKey(key), null, true); },
                asyncOptions,
                callback);
        }

Same methods

Table::GetItemAsync ( DynamoDBEntry>.IDictionary key, GetItemOperationConfig config, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null ) : void
Table::GetItemAsync ( Primitive hashKey, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null ) : void
Table::GetItemAsync ( Primitive hashKey, GetItemOperationConfig config, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null ) : void
Table::GetItemAsync ( Primitive hashKey, Primitive rangeKey, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null ) : void
Table::GetItemAsync ( Primitive hashKey, Primitive rangeKey, GetItemOperationConfig config, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null ) : void

Usage Example

        /// <summary>
        /// Gets a resource of a given type and with the provided id from a given table
        /// </summary>
        /// <param name="table"></param>
        /// <param name="typeName"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        private async Task <dynamic> Get(DynamoDbTable table, string typeName, string id)
        {
            var hashKey  = new Primitive($"{typeName}");
            var rangeKey = new Primitive(id);

            Logger.Debug("Getting item with hash key {0} and range key {1} from table {2}...", hashKey, rangeKey, table.TableName);

            var result = await table.GetItemAsync(hashKey, rangeKey);

            return(result != null?DynamoDbDocumentHelper.ToObject(result) : null);
        }
All Usage Examples Of Amazon.DynamoDBv2.DocumentModel.Table::GetItemAsync