Пример #1
0
        public XDocument Export(IEnumerable<XPBaseObject> baseCollection, ISerializationConfigurationGroup serializationConfigurationGroup){
            var xDocument = new XDocument();
            var root = new XElement("SerializedObjects");
            xDocument.Add(root);
            _serializeClassInfoGraphNodesCalculator =new SerializeClassInfoGraphNodesCalculator(serializationConfigurationGroup);    
            foreach (var baseObject in baseCollection) {
                IEnumerable<IClassInfoGraphNode> serializedClassInfoGraphNodes =
                    _serializeClassInfoGraphNodesCalculator.GetSerializedClassInfoGraphNodes(baseObject);
                ExportCore(baseObject, serializedClassInfoGraphNodes, root);
            }
            return xDocument;

        }
Пример #2
0
        public XDocument Export(IEnumerable <XPBaseObject> baseCollection, ISerializationConfigurationGroup serializationConfigurationGroup)
        {
            var xDocument = new XDocument();
            var root      = new XElement("SerializedObjects");

            xDocument.Add(root);
            _serializeClassInfoGraphNodesCalculator = new SerializeClassInfoGraphNodesCalculator(serializationConfigurationGroup);
            foreach (var baseObject in baseCollection)
            {
                IEnumerable <IClassInfoGraphNode> serializedClassInfoGraphNodes =
                    _serializeClassInfoGraphNodesCalculator.GetSerializedClassInfoGraphNodes(baseObject);
                ExportCore(baseObject, serializedClassInfoGraphNodes, root);
            }
            return(xDocument);
        }
Пример #3
0
        void CreateRefElelement(IClassInfoGraphNode classInfoGraphNode, string typeName, XElement root, XPBaseObject theObject, XElement propertyElement)
        {
            var serializedObjectRefElement = new XElement("SerializedObjectRef");

            propertyElement.Add(serializedObjectRefElement);
            serializedObjectRefElement.Add(new XAttribute("type", typeName));
            serializedObjectRefElement.Add(new XAttribute("strategy", classInfoGraphNode.SerializationStrategy));
            if (theObject != null)
            {
                IEnumerable <IClassInfoGraphNode> classInfoGraphNodes = _serializeClassInfoGraphNodesCalculator.GetSerializedClassInfoGraphNodes(theObject, typeName);
                CreateRefKeyElements(classInfoGraphNodes, theObject, serializedObjectRefElement);
                if (classInfoGraphNode.SerializationStrategy == SerializationStrategy.SerializeAsObject)
                {
                    ExportCore(theObject, classInfoGraphNodes, root);
                }
            }
        }
Пример #4
0
        void CreateRefElelement(IClassInfoGraphNode classInfoGraphNode, Type objectType, XElement root,
                                object theObject, XElement propertyElement, ElementSchema elementSchema)
        {
            var serializedObjectRefElement = new XElement(elementSchema.SerializedObjectRef);

            propertyElement.Add(serializedObjectRefElement);
            serializedObjectRefElement.Add(new XAttribute(elementSchema.Type, objectType.Name));
            serializedObjectRefElement.Add(new XAttribute(elementSchema.Strategy, classInfoGraphNode.SerializationStrategy));
            if (theObject != null)
            {
                var classInfoGraphNodes = _serializeClassInfoGraphNodesCalculator.GetSerializedClassInfoGraphNodes(theObject, objectType.Name).ToArray();
                CreateRefKeyElements(XafTypesInfo.CastTypeToTypeInfo(objectType), classInfoGraphNodes, theObject, serializedObjectRefElement, elementSchema);
                if (classInfoGraphNode.SerializationStrategy == SerializationStrategy.SerializeAsObject)
                {
                    ExportCore(theObject, classInfoGraphNodes, root, elementSchema);
                }
            }
        }
Пример #5
0
        public XDocument Export(IEnumerable <object> baseCollection,
                                ISerializationConfigurationGroup serializationConfigurationGroup)
        {
            var xDocument = new XDocument();

            _minifyOutput = serializationConfigurationGroup.MinifyOutput;
            var elementInfo = ElementSchema.Get(_minifyOutput);
            var root        = new XElement(elementInfo.SerializedObjects);

            root.Add(new XAttribute(ElementSchema.Minified, _minifyOutput));
            xDocument.Add(root);
            _serializeClassInfoGraphNodesCalculator =
                new SerializeClassInfoGraphNodesCalculator(serializationConfigurationGroup, _objectSpace);
            foreach (var baseObject in baseCollection)
            {
                var serializedClassInfoGraphNodes = _serializeClassInfoGraphNodesCalculator.GetSerializedClassInfoGraphNodes(baseObject);
                ExportCore(baseObject, serializedClassInfoGraphNodes, root, elementInfo);
            }
            return(xDocument);
        }