我们可以从.net中的dynamodb中获取该项目,如下所示
var entity = await _context.LoadAsync(id);
如何获取所需的属性而不是完整的项目?
答案 0 :(得分:0)
您可以使用ProjectionExpression指定您希望DynamoDB为您检索哪些属性。
这是.NET example, from the docs:
// using Amazon.DynamoDBv2;
// using Amazon.DynamoDBv2.Model;
var client = new AmazonDynamoDBClient();
var request = new GetItemRequest
{
TableName = "YourTableName",
ProjectionExpression = "Id, Attribute1, Attribute2",
Key = new Dictionary<string, AttributeValue>
{
{ "Id", new AttributeValue { N = "some_value_for_id" } }
},
};
var response = client.GetItem(request);