// Serializing an object into a DynamoDB document private static ItemStorage ObjectToItemStorage <T>(T toStore, bool keysOnly, bool ignoreNullValues) { if (toStore == null) { return(null); } Type objectType = typeof(T); ItemStorageConfig config = ItemStorageConfigCache.GetConfig(objectType); if (config == null) { return(null); } ItemStorage storage = ObjectToItemStorage <T>(toStore, keysOnly, ignoreNullValues, config); return(storage); }
// Searching private IEnumerable <T> FromSearch <T>(Search search) { if (search == null) { throw new ArgumentNullException("search"); } ItemStorageConfig storageConfig = ItemStorageConfigCache.GetConfig <T>(); while (!search.IsDone) { List <Document> set = search.GetNextSet(); foreach (var document in set) { ItemStorage storage = new ItemStorage(storageConfig); storage.Document = document; T instance = DocumentToObject <T>(storage); yield return(instance); } } }