2

DynamoDB .NET オブジェクトの永続性モデルを使用して、以下の条件でテーブルをスキャンしています。

public IEnumerable<Product> GetProducts(string attribute1Value, string attribute2Value
{
    IEnumerable<Product> products = null;
    try
    {
        RegionEndpoint region = RegionEndpoint.GetBySystemName("us-east-1");
        AmazonDynamoDB client = new AmazonDynamoDBClient(account.AwsAccessKey, account.AwsSecretKey, region);

        DynamoDBContext context = new DynamoDBContext(client);
        products = context.Scan<Product>(
            new ScanCondition("attribute1", ScanOperator.Equal, attribute1Value),
            new ScanCondition("attribute2", ScanOperator.Equal, attribute2Value));

    }
    catch (AmazonServiceException ase)
    {
        log.Error("Amazon Service Exception, Message: " + ase.Message + ", request id: " + ase.RequestId);
    }
    catch (Exception e)
    {
        log.Error("Exception: " + e.Message);
    }
    return products;
}

DynamoDBContext を使用しているときに、DynamoDB によって設定された 1 MB の制限を超えた場合、出力を処理するにはどうすればよいですか? ありがとう

4

1 に答える 1

6

1MB の制限に達すると、DynamoDB はアイテムの複数のページを返します。DynamoDBContext.Scan オペレーションは、結果セットを自動的にページングします (遅延読み込み)。したがって、あなたの観点からは、余分なことをする必要はなく、単に IEnumerable オブジェクトを列挙するだけで、一致するすべてのアイテムが返されます。

于 2012-10-05T19:09:28.443 に答える