Ejemplo n.º 1
0
        // DynamoDBEntry <--> Object
        private static object FromDynamoDBEntry(Type targetType, DynamoDBEntry value, IPropertyConverter converter)
        {
            if (converter != null)
            {
                return(converter.FromEntry(value));
            }

            object output;

            Primitive primitive = value as Primitive;

            if (primitive != null && TryFromPrimitive(targetType, primitive, out output))
            {
                return(output);
            }

            PrimitiveList primitiveList = value as PrimitiveList;

            if (primitiveList != null && TryFromPrimitiveList(targetType, primitiveList, out output))
            {
                return(output);
            }

            throw new InvalidOperationException("Unable to convert to type " + targetType.FullName);
        }