Example #1
0
        public object Map(Type propertyType, object value)
        {
            var things = (from object thing in (IEnumerable)value
                          select mapper.GetTheValue(thing.GetType(), thing)).ToList();

            return(things.Count > 0 ? things : null);
        }
Example #2
0
        public object Map(Type propertyType, object value)
        {
            var newValue = new Dictionary <string, object>();

            foreach (var property in value.GetType().GetProperties())
            {
                newValue[property.Name] = property.GetValue(value);
            }
            return(dataMapper.GetTheValue(newValue.GetType(), newValue));
        }
        public object Map(Type propertyType, object value)
        {
            var newValue = new Dictionary <string, object>();

#if NETSTANDARD1_6
            foreach (var property in value.GetType().GetRuntimeProperties())
#else
            foreach (var property in value.GetType().GetProperties())
#endif
            { newValue[property.Name] = property.GetValue(value); }
            return(dataMapper.GetTheValue(newValue.GetType(), newValue));
        }
        public object Map(Type propertyType, object value)
        {
            var original   = (IDictionary <string, object>)value;
            var dictionary = new Dictionary <string, object>();

            foreach (var item in original.Where(i => i.Value != null))
            {
                var itemKey   = SnakeCase.Convert(item.Key);
                var itemValue = item.Value;
                dictionary[itemKey] = dataMapper.GetTheValue(itemValue.GetType(), itemValue);
            }
            return(dictionary.Count > 0 ? dictionary : null);
        }