Example #1
0
        /// <summary>
        /// Uses heavy none cached reflection. Should be used with caution
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public Dictionary <string, object> Convert(object target)
        {
            Type targetType = target.GetType();

            if (typeof(IProxyTargetAccessor).IsAssignableFrom(targetType))
            {
                targetType = targetType.BaseType;
            }

            var properties = TypeUtils
                             .GetProperties(targetType, _contentTypeLoader)
                             .Where(x => x.HasAttribute <JsonIgnoreAttribute>() == false);

            return(ObjectUtils.ConvertProperties(target, properties));
        }