/// <summary>
/// Tries to make up a batch get operation from SearchConditions
/// </summary>
private static DocumentBatchGet GetBatchGetOperationForSearchConditions(Table tableDefinition, SearchConditions conditions, string keyFieldName, Primitive hashKeyValue)
{
// there should be only one IN operator for key field
if
(!(
(conditions.Count == 1)
&&
(conditions.Keys.First() == keyFieldName)
))
{
return null;
}
var conditionList = conditions.Values.First();
if
(!(
(conditionList.Count == 1)
&&
(conditionList.First().Operator == ScanOperator.In)
))
{
return null;
}
var result = tableDefinition.CreateBatchGet();
foreach (var value in conditionList.First().Values)
{
if (hashKeyValue == null)
{
result.AddKey((Primitive)value);
}
else
{
result.AddKey(hashKeyValue, (Primitive)value);
}
}
return result;
}