private bool TryFromMap(Type targetType, Document map, DynamoDBFlatConfig flatConfig, out object output)
{
output = null;
if (!Utils.CanInstantiate(targetType))
{
return(false);
}
Type valueType;
if (!IsSupportedDictionaryType(targetType, out valueType))
{
return(false);
}
var dictionary = Utils.Instantiate(targetType);
var idictionary = dictionary as IDictionary;
var propertyStorage = new SimplePropertyStorage(valueType);
foreach (var kvp in map)
{
var key = kvp.Key;
var entry = kvp.Value;
var item = FromDynamoDBEntry(propertyStorage, entry, flatConfig);
idictionary.Add(key, item);
}
output = dictionary;
return(true);
}