// Query/Scan filter creation private static ScanFilter ComposeScanFilter(IEnumerable <ScanCondition> conditions, ItemStorageConfig storageConfig) { ScanFilter filter = new ScanFilter(); foreach (var condition in conditions) { PropertyStorage propertyStorage = storageConfig.GetPropertyStorage(condition.PropertyName); List <AttributeValue> attributeValues = new List <AttributeValue>(); foreach (var value in condition.Values) { var entry = ToDynamoDBEntry(propertyStorage, value, true); if (entry == null) { throw new InvalidOperationException( string.Format("Unable to convert value corresponding to property [{0}] to DynamoDB representation", condition.PropertyName)); } AttributeValue nativeValue = entry.ConvertToAttributeValue(); if (nativeValue != null) { attributeValues.Add(nativeValue); } } filter.AddCondition(propertyStorage.AttributeName, condition.Operator, attributeValues); } return(filter); }
// Key creation private static DynamoDBEntry ValueToDynamoDBEntry(string propertyName, object value, ItemStorageConfig storageConfig) { PropertyStorage propertyStorage = storageConfig.GetPropertyStorage(propertyName); var entry = ToDynamoDBEntry(propertyStorage, value); return(entry); }