diff --git a/AWSSDK/Amazon.DynamoDB/DataModel/Context.cs b/AWSSDK/Amazon.DynamoDB/DataModel/Context.cs index d37a347d4d43..b2ea1ee80a89 100644 --- a/AWSSDK/Amazon.DynamoDB/DataModel/Context.cs +++ b/AWSSDK/Amazon.DynamoDB/DataModel/Context.cs @@ -796,7 +796,7 @@ public IEnumerable Scan(IEnumerable conditions, DynamoDBOpe /// Lazy-loaded collection of results. public IEnumerable Query(object hashKeyValue) { - return QueryHelper(hashKeyValue, QueryOperator.Equal, null, null); + return QueryHelper(hashKeyValue, QueryOperator.Equal, null, false, null); } /// @@ -809,7 +809,7 @@ public IEnumerable Query(object hashKeyValue) /// Lazy-loaded collection of results. public IEnumerable Query(object hashKeyValue, DynamoDBOperationConfig operationConfig) { - return QueryHelper(hashKeyValue, QueryOperator.Equal, null, operationConfig); + return QueryHelper(hashKeyValue, QueryOperator.Equal, null, false, operationConfig); } /// @@ -830,7 +830,7 @@ public IEnumerable Query(object hashKeyValue, QueryOperator op, params obj if (values == null || values.Length == 0) throw new ArgumentOutOfRangeException("values"); - return QueryHelper(hashKeyValue, op, values, null); + return QueryHelper(hashKeyValue, op, values, false, null); } /// @@ -845,17 +845,18 @@ public IEnumerable Query(object hashKeyValue, QueryOperator op, params obj /// For all operations except QueryOperator.Between, values should be one value. /// For QueryOperator.Betwee, values should be two values. /// + /// Indicates whether the results should be sorted backwards or not. /// Config object which can be used to override the table used. /// Lazy-loaded collection of results. - public IEnumerable Query(object hashKeyValue, QueryOperator op, IEnumerable values, DynamoDBOperationConfig operationConfig) + public IEnumerable Query(object hashKeyValue, QueryOperator op, IEnumerable values, bool backwardsOrder, DynamoDBOperationConfig operationConfig) { if (values == null) throw new ArgumentNullException("values"); - return QueryHelper(hashKeyValue, op, values, operationConfig); + return QueryHelper(hashKeyValue, op, values, backwardsOrder, operationConfig); } - private IEnumerable QueryHelper(object hashKeyValue, QueryOperator op, IEnumerable values, DynamoDBOperationConfig operationConfig) + private IEnumerable QueryHelper(object hashKeyValue, QueryOperator op, IEnumerable values, bool backwardsOrder, DynamoDBOperationConfig operationConfig) { ItemStorageConfig storageConfig = ItemStorageConfigCache.GetConfig(); RangeFilter filter = ComposeRangeFilter(op, values, storageConfig); @@ -865,7 +866,7 @@ private IEnumerable QueryHelper(object hashKeyValue, QueryOperator op, IEn DynamoDBFlatConfig currentConfig = new DynamoDBFlatConfig(operationConfig, this.config); Table table = GetTargetTable(storageConfig, currentConfig); - Search query = table.Query(new QueryOperationConfig { HashKey = hashKeyEntry, Filter = filter, ConsistentRead = currentConfig.ConsistentRead.Value }); + Search query = table.Query(new QueryOperationConfig { HashKey = hashKeyEntry, Filter = filter, ConsistentRead = currentConfig.ConsistentRead.Value, BackwardSearch = backwardsOrder }); query.AttributesToGet = storageConfig.AttributesToGet; return FromSearch(query); diff --git a/AWSSDK/Amazon.DynamoDB/DataModel/IDynamoDBContext.cs b/AWSSDK/Amazon.DynamoDB/DataModel/IDynamoDBContext.cs index f98839fbce13..e135a871b816 100644 --- a/AWSSDK/Amazon.DynamoDB/DataModel/IDynamoDBContext.cs +++ b/AWSSDK/Amazon.DynamoDB/DataModel/IDynamoDBContext.cs @@ -485,9 +485,10 @@ public interface IDynamoDBContext /// For all operations except QueryOperator.Between, values should be one value. /// For QueryOperator.Betwee, values should be two values. /// + /// Indicates whether the results should be sorted backwards or not. /// Config object which can be used to override the table used. /// Lazy-loaded collection of results. - IEnumerable Query(object hashKeyValue, QueryOperator op, IEnumerable values, DynamoDBOperationConfig operationConfig); + IEnumerable Query(object hashKeyValue, QueryOperator op, IEnumerable values, bool backwardsOrder, DynamoDBOperationConfig operationConfig); ///