Exemplo n.º 1
0
        /// <summary>
        /// 把Json信息解释成实体
        /// </summary>
        /// <param name="json"></param>
        /// <returns></returns>
        public static T DeserializeObject <T>(string json, IEnumerable <string> propertyMap = null)
            where T : new()
        {
            Dictionary <string, object> dic = _serializer.Deserialize <Dictionary <string, object> >(json);
            T obj = EntitySerializer.DeserializeToObject <T>(dic, propertyMap);

            return(obj);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 把json信息填充到实体
        /// </summary>
        /// <param name="json"></param>
        /// <returns></returns>
        public static void DeserializeObject(object obj, string json, IEnumerable <string> propertyMap = null)
        {
            Dictionary <string, object> dic = _serializer.Deserialize <Dictionary <string, object> >(json);

            EntitySerializer.DeserializeToObject(obj, dic, propertyMap);
        }