Пример #1
0
        /// <summary>
        /// Serialize object to default entity
        /// </summary>
        /// <param name="pObject"></param>
        /// <returns></returns>
        public SerializeEntity SerializeObjectToDefaultEntity(Object pObject)
        {
            SerializeEntity serializeEntity = new SerializeEntity(this.SerializeObject(pObject),
                                                                  pObject.GetType().FullName,
                                                                  pObject.GetType().Assembly.FullName);

            return(serializeEntity);
        }
Пример #2
0
        /// <summary>
        /// Serialize objects to default entities
        /// </summary>
        /// <param name="objects"></param>
        /// <returns></returns>
        public SerializeEntity[] SerializeObjectToDefaultEntity(Object[] objects)
        {
            SerializeEntity[] serializedEntities = new SerializeEntity[objects.Length];
            int index = 0;

            foreach (object entity in objects)
            {
                serializedEntities[index] = this.SerializeObjectToDefaultEntity(entity);
                index++;
            }
            return(serializedEntities);
        }
Пример #3
0
        public Object DeserializeObject(SerializeEntity serializedEntity)
        {
            object result = ReflectionHelper.CreateObjectInstance(serializedEntity.ObjectTypeName,
                                                                  serializedEntity.AssemblyTypeName);

            if (result != null)
            {
                return(this.DeserializeObject(serializedEntity.XmlSource, result.GetType()));
            }
            else
            {
                return(null);
            }
        }