コード例 #1
0
 void Generate(IClassInfoGraphNode classInfoGraphNode, ITypeInfo memberInfo, ObjectSpace objectSpace, Action<IList<IMemberInfo>> action)
 {
     foreach (var infoGraphNode in GetGraph(objectSpace, memberInfo.Type, action))
     {
         classInfoGraphNode.Children.Add(infoGraphNode);
     }
 }
コード例 #2
0
ファイル: ExportEngine.cs プロジェクト: xwagner2/eXpand
        void SetMemberValue(XPBaseObject selectedObject, IClassInfoGraphNode classInfoGraphNode,
                            XElement propertyElement)
        {
            var xpMemberInfo = selectedObject.ClassInfo.FindMember(classInfoGraphNode.Name);

            if (xpMemberInfo != null)
            {
                var memberValue = selectedObject.GetMemberValue(classInfoGraphNode.Name);
                if (xpMemberInfo.Converter != null)
                {
                    memberValue = (xpMemberInfo.Converter.ConvertToStorageType(memberValue));
                }
                if (memberValue is byte[])
                {
                    memberValue = Convert.ToBase64String((byte[])memberValue);
                }
                if (memberValue is DateTime)
                {
                    memberValue = ((DateTime)memberValue).Ticks;
                }

                if (memberValue is string)
                {
                    memberValue = IAFModule.SanitizeXmlString((string)memberValue);
                    propertyElement.Add(new XCData(memberValue.ToString()));
                }
                else
                {
                    propertyElement.Value = GetInvariantValue(memberValue);
                }
            }
        }
コード例 #3
0
ファイル: ExportEngine.cs プロジェクト: corzar/eXpand
 void createCollectionProperty(XPBaseObject selectedObject, IClassInfoGraphNode classInfoGraphNode, XElement root,
                               XElement propertyElement) {
     XPMemberInfo memberInfo = selectedObject.ClassInfo.GetMember(classInfoGraphNode.Name);
     var theObjects = (XPBaseCollection)memberInfo.GetValue(selectedObject);
     foreach (XPBaseObject theObject in theObjects) {
         CreateRefElelement(classInfoGraphNode,theObject.GetType().Name, root,  theObject, propertyElement);
     }
 }
コード例 #4
0
ファイル: ExportEngine.cs プロジェクト: corzar/eXpand
 object GetMemberValue(XPBaseObject selectedObject, IClassInfoGraphNode classInfoGraphNode) {
     var memberValue = selectedObject.GetMemberValue(classInfoGraphNode.Name);
     var xpMemberInfo = selectedObject.ClassInfo.GetMember(classInfoGraphNode.Name);
     if (xpMemberInfo.Converter!= null){
         return xpMemberInfo.Converter.ConvertToStorageType(memberValue);
     }
     return memberValue;
 }
コード例 #5
0
ファイル: ExportEngine.cs プロジェクト: gvilas/eXpand
 XElement GetPropertyElement(XElement serializedObjectElement, IClassInfoGraphNode classInfoGraphNode) {
     var propertyElement = new XElement("Property");
     serializedObjectElement.Add(propertyElement);
     propertyElement.Add(new XAttribute("type", classInfoGraphNode.NodeType.ToString().MakeFirstCharLower()));
     propertyElement.Add(new XAttribute("name", classInfoGraphNode.Name));
     propertyElement.Add(new XAttribute("isKey", classInfoGraphNode.Key));
     return propertyElement;
 }
コード例 #6
0
        IClassInfoGraphNode CreateComplexNode(IMemberInfo memberInfo, IObjectSpace objectSpace)
        {
            NodeType            nodeType           = memberInfo.MemberTypeInfo.IsPersistent ? NodeType.Object : NodeType.Collection;
            IClassInfoGraphNode classInfoGraphNode = CreateClassInfoGraphNode(objectSpace, memberInfo, nodeType);

            classInfoGraphNode.SerializationStrategy = GetSerializationStrategy(memberInfo, SerializationStrategy.SerializeAsObject);
            Generate(objectSpace, ReflectionHelper.GetType(classInfoGraphNode.TypeName));
            return(classInfoGraphNode);
        }
コード例 #7
0
ファイル: ExportEngine.cs プロジェクト: xwagner2/eXpand
        XElement GetPropertyElement(XElement serializedObjectElement, IClassInfoGraphNode classInfoGraphNode)
        {
            var propertyElement = new XElement("Property");

            serializedObjectElement.Add(propertyElement);
            propertyElement.Add(new XAttribute("type", classInfoGraphNode.NodeType.ToString().MakeFirstCharLower()));
            propertyElement.Add(new XAttribute("name", classInfoGraphNode.Name));
            propertyElement.Add(new XAttribute("isKey", classInfoGraphNode.Key));
            return(propertyElement);
        }
コード例 #8
0
ファイル: ExportEngine.cs プロジェクト: aois-dev/eXpand
        void CreateObjectProperty(ITypeInfo typeInfo, object selectedObject, XElement propertyElement,
                                  IClassInfoGraphNode classInfoGraphNode, XElement root, ElementSchema elementSchema)
        {
            var memberInfo = typeInfo.FindMember(classInfoGraphNode.Name);

            if (memberInfo != null)
            {
                var theObject = (XPBaseObject)memberInfo.GetValue(selectedObject);
                CreateRefElelement(classInfoGraphNode, theObject?.GetType() ?? memberInfo.MemberType, root, theObject, propertyElement, elementSchema);
            }
        }
コード例 #9
0
ファイル: ExportEngine.cs プロジェクト: aois-dev/eXpand
        void CreateCollectionProperty(ITypeInfo typeInfo, object selectedObject, IClassInfoGraphNode classInfoGraphNode,
                                      XElement root, XElement propertyElement, ElementSchema elementSchema)
        {
            var memberInfo = typeInfo.FindMember(classInfoGraphNode.Name);

            if (memberInfo?.GetValue(selectedObject) is IEnumerable theObjects)
            {
                foreach (var theObject in theObjects)
                {
                    CreateRefElelement(classInfoGraphNode, theObject.GetType(), root, theObject, propertyElement, elementSchema);
                }
            }
        }
コード例 #10
0
ファイル: ExportEngine.cs プロジェクト: xwagner2/eXpand
        void CreateObjectProperty(XPBaseObject selectedObject, XElement propertyElement,
                                  IClassInfoGraphNode classInfoGraphNode, XElement root)
        {
            XPMemberInfo memberInfo = selectedObject.ClassInfo.FindMember(classInfoGraphNode.Name);

            if (memberInfo != null)
            {
                var theObject = (XPBaseObject)memberInfo.GetValue(selectedObject);
                CreateRefElelement(classInfoGraphNode,
                                   theObject != null ? theObject.GetType().Name : memberInfo.MemberType.Name, root,
                                   theObject, propertyElement);
            }
        }
コード例 #11
0
ファイル: ExportEngine.cs プロジェクト: corzar/eXpand
        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 = GetClassInfoGraphNodes(theObject, typeName);

                createRefKeyElements(classInfoGraphNodes, theObject, serializedObjectRefElement);
                if (serializedObjectRefElement.FindObjectFromRefenceElement(true) == null &&classInfoGraphNode.SerializationStrategy == SerializationStrategy.SerializeAsObject)
                    ExportCore(theObject, classInfoGraphNodes, root);
            }
        }
コード例 #12
0
        void CreateCollectionProperty(XPBaseObject selectedObject, IClassInfoGraphNode classInfoGraphNode, XElement root,
                                      XElement propertyElement)
        {
            XPMemberInfo memberInfo = selectedObject.ClassInfo.FindMember(classInfoGraphNode.Name);

            if (memberInfo != null)
            {
                var theObjects = (IEnumerable)memberInfo.GetValue(selectedObject);
                foreach (XPBaseObject theObject in theObjects)
                {
                    CreateRefElelement(classInfoGraphNode, theObject.GetType().Name, root, theObject, propertyElement);
                }
            }
        }
コード例 #13
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);
                }
            }
        }
コード例 #14
0
ファイル: ExportEngine.cs プロジェクト: gvilas/eXpand
 void SetMemberValue(XPBaseObject selectedObject, IClassInfoGraphNode classInfoGraphNode, XElement propertyElement) {
     var memberValue = selectedObject.GetMemberValue(classInfoGraphNode.Name);
     var xpMemberInfo = selectedObject.ClassInfo.FindMember(classInfoGraphNode.Name);
     if (xpMemberInfo != null ) {
         if (xpMemberInfo.Converter != null)
             memberValue = (xpMemberInfo.Converter.ConvertToStorageType(memberValue));
         if (memberValue is byte[])
             memberValue = Convert.ToBase64String((byte[])memberValue);
         if (memberValue is DateTime)
             memberValue = ((DateTime)memberValue).Ticks;
         if (memberValue is string)
             propertyElement.Add(new XCData(memberValue.ToString()));
         else                {
             propertyElement.Value = GetInvariantValue(memberValue);
         }
     }
 }
コード例 #15
0
ファイル: ExportEngine.cs プロジェクト: aois-dev/eXpand
        XElement GetPropertyElement(XElement serializedObjectElement, IClassInfoGraphNode classInfoGraphNode,
                                    ElementSchema elementSchema)
        {
            var propertyElement = new XElement(elementSchema.Property);

            serializedObjectElement.Add(propertyElement);
            if ((_minifyOutput && classInfoGraphNode.NodeType != NodeType.Simple) || !_minifyOutput)
            {
                propertyElement.Add(new XAttribute(elementSchema.Type, classInfoGraphNode.NodeType.ToString().FirstCharacterToLower()));
            }
            propertyElement.Add(new XAttribute(elementSchema.Name, classInfoGraphNode.Name));
            if ((_minifyOutput && classInfoGraphNode.Key) || !_minifyOutput)
            {
                propertyElement.Add(new XAttribute(elementSchema.IsKey, classInfoGraphNode.Key));
            }
            return(propertyElement);
        }
コード例 #16
0
ファイル: ExportEngine.cs プロジェクト: aois-dev/eXpand
        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);
                }
            }
        }
コード例 #17
0
ファイル: ExportEngine.cs プロジェクト: aois-dev/eXpand
        void SetMemberValue(ITypeInfo typeInfo, object theObject, IClassInfoGraphNode classInfoGraphNode,
                            XElement propertyElement)
        {
            var memberInfo = typeInfo.FindMember(classInfoGraphNode.Name);

            if (memberInfo != null)
            {
                var memberValue    = memberInfo.GetValue(theObject);
                var valueConverter = memberInfo.FindAttribute <ValueConverterAttribute>();
                if (valueConverter != null)
                {
                    memberValue = (valueConverter.Converter.ConvertToStorageType(memberValue));
                }
                if (memberValue is byte[])
                {
                    memberValue = Convert.ToBase64String((byte[])memberValue);
                }
                if (memberValue is DateTime)
                {
                    memberValue = ((DateTime)memberValue).Ticks;
                }
                if ((_minifyOutput && !memberInfo.HasDefaultValue(memberValue)) || !_minifyOutput)
                {
                    if (memberValue is string)
                    {
                        memberValue = IAFModule.SanitizeXmlString((string)memberValue);
                        propertyElement.Add(new XCData(memberValue.ToString()));
                    }
                    else
                    {
                        propertyElement.Value = GetInvariantValue(memberValue);
                    }
                }
                else
                {
                    propertyElement.Remove();
                }
            }
        }
コード例 #18
0
ファイル: ExportEngine.cs プロジェクト: gvilas/eXpand
 void CreateObjectProperty(XPBaseObject selectedObject, XElement propertyElement, IClassInfoGraphNode classInfoGraphNode, XElement root) {
     XPMemberInfo memberInfo = selectedObject.ClassInfo.FindMember(classInfoGraphNode.Name);
     if (memberInfo != null) {
         var theObject = (XPBaseObject) memberInfo.GetValue(selectedObject);
         CreateRefElelement(classInfoGraphNode,theObject!= null?theObject.GetType().Name:memberInfo.MemberType.Name, root,  theObject, propertyElement);
     }
 }
コード例 #19
0
ファイル: ExportEngine.cs プロジェクト: gvilas/eXpand
 void CreateCollectionProperty(XPBaseObject selectedObject, IClassInfoGraphNode classInfoGraphNode, XElement root,
                               XElement propertyElement) {
     XPMemberInfo memberInfo = selectedObject.ClassInfo.FindMember(classInfoGraphNode.Name);
     if (memberInfo != null) {
         var theObjects = (IEnumerable)memberInfo.GetValue(selectedObject);
         foreach (XPBaseObject theObject in theObjects) {
             CreateRefElelement(classInfoGraphNode,theObject.GetType().Name, root,  theObject, propertyElement);
         }
     }
 }