Esempio n. 1
0
        private static DynamoDBEntry ToDynamoDBEntry(Type type, object value, IPropertyConverter converter, bool canReturnPrimitiveInsteadOfList)
        {
            if (value == null)
            {
                return(null);
            }

            if (converter != null)
            {
                return(converter.ToEntry(value));
            }

            Primitive primitive;

            if (TryToPrimitive(type, value, out primitive))
            {
                return(primitive);
            }

            DynamoDBEntry primitiveList;

            if (TryToPrimitiveList(type, value, canReturnPrimitiveInsteadOfList, out primitiveList))
            {
                return(primitiveList);
            }

            throw new InvalidOperationException("Unable to convert value of type " + value.GetType().FullName + ", type is not primitive or primitive collection and does not define a converter");
        }