Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions AWSSDK/Amazon.DynamoDB/DataModel/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ public IEnumerable<T> Scan<T>(IEnumerable<ScanCondition> conditions, DynamoDBOpe
/// <returns>Lazy-loaded collection of results.</returns>
public IEnumerable<T> Query<T>(object hashKeyValue)
{
return QueryHelper<T>(hashKeyValue, QueryOperator.Equal, null, null);
return QueryHelper<T>(hashKeyValue, QueryOperator.Equal, null, false, null);
}

/// <summary>
Expand All @@ -809,7 +809,7 @@ public IEnumerable<T> Query<T>(object hashKeyValue)
/// <returns>Lazy-loaded collection of results.</returns>
public IEnumerable<T> Query<T>(object hashKeyValue, DynamoDBOperationConfig operationConfig)
{
return QueryHelper<T>(hashKeyValue, QueryOperator.Equal, null, operationConfig);
return QueryHelper<T>(hashKeyValue, QueryOperator.Equal, null, false, operationConfig);
}

/// <summary>
Expand All @@ -830,7 +830,7 @@ public IEnumerable<T> Query<T>(object hashKeyValue, QueryOperator op, params obj
if (values == null || values.Length == 0)
throw new ArgumentOutOfRangeException("values");

return QueryHelper<T>(hashKeyValue, op, values, null);
return QueryHelper<T>(hashKeyValue, op, values, false, null);
}

/// <summary>
Expand All @@ -845,17 +845,18 @@ public IEnumerable<T> Query<T>(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.
/// </param>
/// <param name="backwardsOrder">Indicates whether the results should be sorted backwards or not.</param>
/// <param name="operationConfig">Config object which can be used to override the table used.</param>
/// <returns>Lazy-loaded collection of results.</returns>
public IEnumerable<T> Query<T>(object hashKeyValue, QueryOperator op, IEnumerable<object> values, DynamoDBOperationConfig operationConfig)
public IEnumerable<T> Query<T>(object hashKeyValue, QueryOperator op, IEnumerable<object> values, bool backwardsOrder, DynamoDBOperationConfig operationConfig)
{
if (values == null)
throw new ArgumentNullException("values");

return QueryHelper<T>(hashKeyValue, op, values, operationConfig);
return QueryHelper<T>(hashKeyValue, op, values, backwardsOrder, operationConfig);
}

private IEnumerable<T> QueryHelper<T>(object hashKeyValue, QueryOperator op, IEnumerable<object> values, DynamoDBOperationConfig operationConfig)
private IEnumerable<T> QueryHelper<T>(object hashKeyValue, QueryOperator op, IEnumerable<object> values, bool backwardsOrder, DynamoDBOperationConfig operationConfig)
{
ItemStorageConfig storageConfig = ItemStorageConfigCache.GetConfig<T>();
RangeFilter filter = ComposeRangeFilter(op, values, storageConfig);
Expand All @@ -865,7 +866,7 @@ private IEnumerable<T> QueryHelper<T>(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<T>(query);
Expand Down
3 changes: 2 additions & 1 deletion AWSSDK/Amazon.DynamoDB/DataModel/IDynamoDBContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// </param>
/// <param name="backwardsOrder">Indicates whether the results should be sorted backwards or not.</param>
/// <param name="operationConfig">Config object which can be used to override the table used.</param>
/// <returns>Lazy-loaded collection of results.</returns>
IEnumerable<T> Query<T>(object hashKeyValue, QueryOperator op, IEnumerable<object> values, DynamoDBOperationConfig operationConfig);
IEnumerable<T> Query<T>(object hashKeyValue, QueryOperator op, IEnumerable<object> values, bool backwardsOrder, DynamoDBOperationConfig operationConfig);


/// <summary>
Expand Down