コード例 #1
0
        protected override void DeserializeValueFromXml(XmlProxy parent)
        {
            XmlProxy xmlContent = parent["content"];

            this.Name = xmlContent.GetAttr("name");
            InternalDeserializeFromXml(xmlContent);
        }
コード例 #2
0
        public void SerializeToXml(XmlWriter writer, string propertyName)
        {
            XmlProxy xmlRoot = new XmlProxy(propertyName);

            SerializeToXml(xmlRoot);
            XmlProxySerializer.Instance.Serialize(xmlRoot, writer);
        }
コード例 #3
0
ファイル: XmlProxySerializer.cs プロジェクト: psulek/doemd
        public string Serialize(XmlProxy item, Encoding encoding)
        {
            if (item == null)
            {
                return(string.Empty);
            }

            MemoryStream ms     = new MemoryStream();
            XmlWriter    writer = new XmlTextWriter(ms, encoding);

            //writer.Formatting = Formatting.Indented;

            Serialize(item, writer);

            /*writer.Close();
             * ms.Flush();
             * ms.Close();*/
            writer.Flush();

            ms.Position = 0;
            string s = new StreamReader(ms).ReadToEnd();

            writer.Close();
            ms.Close();
            return(s);
        }
コード例 #4
0
        public void SerializeToXml(XmlWriter writer)
        {
            XmlProxy xmlRoot = new XmlProxy("key");

            SerializeToXml(xmlRoot);
            XmlProxySerializer.Instance.Serialize(xmlRoot, writer);
        }
コード例 #5
0
        protected override void DeserializeValueFromXml(XmlProxy parent)
        {
            bool currspvc = stopPropagateValueChanges;

            stopPropagateValueChanges = true;

            try
            {
                string elementValue;
                Type   typeOfValue = GetTypeOfValue();

                if (typeOfValue.IsPrimitive)
                {
                    elementValue = parent.GetAttr("value");
                }
                else
                {
                    XmlProxy xmlContent = parent["value"];
                    elementValue = xmlContent.ElementValue;
                }

                object val = elementValue == null ? elementValue: InternalValueFromString(typeOfValue, elementValue);
                SetValue(val);
            }
            finally
            {
                stopPropagateValueChanges = currspvc;
            }
        }
コード例 #6
0
ファイル: ObjectValueInfo.cs プロジェクト: psulek/doemd
        protected override void DeserializeValueFromXml(XmlProxy parent)
        {
            XmlProxy xmlContent = parent["content"];

            this.Value = new ObjectValue();
            this.Value.DeserializeFromXml(xmlContent, "value");
        }
コード例 #7
0
        public void DeserializeFromXml(XmlReader reader, string propertyName)
        {
            XmlProxy xmlRoot = XmlProxySerializer.Instance.Deserialize(reader);

            if (xmlRoot.ElementName == propertyName)
            {
                string           strMultiplicity = xmlRoot.GetAttr("multiplicity");
                MultiplicityKind multiplicityKind;
                if (Enum.TryParse(strMultiplicity, true, out multiplicityKind))
                {
                    this.multiplicity = multiplicityKind;
                }

                string strOnOwnerRemove = xmlRoot.GetAttr("onOwnerRemove");
                AssociationOnRemoveAction onOwnerRemove;
                if (Enum.TryParse(strOnOwnerRemove, true, out onOwnerRemove))
                {
                    this.OnOwnerRemove = onOwnerRemove;
                }

                string strOnTargetRemove = xmlRoot.GetAttr("onTargetRemove");
                AssociationOnRemoveAction onTargetRemove;
                if (Enum.TryParse(strOnTargetRemove, true, out onTargetRemove))
                {
                    this.OnTargetRemove = onTargetRemove;
                }

                this.UseAssociationAttribute = xmlRoot.GetAttr("useAssociationAttribute", true);

                XmlProxy xmlPairTo = xmlRoot["pairTo"];
                this.PairTo = new Defaultable <string>();
                this.PairTo.DeserializeFromXml(xmlPairTo);
            }
        }
コード例 #8
0
        protected override void SerializeValueToXml(XmlProxy parent)
        {
            XmlProxy xmlContent = parent.AddChild("content");

            xmlContent.AddAttribute("name", Name);
            InternalSerializeToXml(xmlContent);
        }
コード例 #9
0
        public void SerializeToXml(XmlWriter writer, string elementName)
        {
            XmlProxy xmlRoot = new XmlProxy("constraints");

            SerializeToXml(xmlRoot);
            XmlProxySerializer.Instance.Serialize(xmlRoot, writer);
        }
コード例 #10
0
        protected override void SerializeValueToXml(XmlProxy parent)
        {
            XmlProxy elementValue = parent.AddChild("value");

            elementValue.SetAttr("kind", this.Kind.ToString());
            elementValue.SetAttr("name", this.Name);
            elementValue.SetAttr("type", this.Type);
        }
コード例 #11
0
//        public void SerializeToXml(XmlWriter writer, string propertyName)
//        {
//            XmlProxy xmlRoot = new XmlProxy(propertyName);
//            SerializeToXml(xmlRoot);
//            XmlProxySerializer.Instance.Serialize(xmlRoot, writer);
//        }

        protected override void SerializeValueToXml(XmlProxy parent)
        {
            XmlProxy xmlContent = parent.AddChild("content");

            xmlContent.SetAttr("default", this.Default);

            this.Value.SerializeToXml(xmlContent, "value");
        }
コード例 #12
0
ファイル: OrmIndexFields.cs プロジェクト: psulek/doemd
 public void DeserializeFromXml(XmlProxy parent)
 {
     if (parent.ElementName == "fields")
     {
         this.KeyFields.DeserializeFromXml(parent, "keyFields");
         this.IncludedFields.DeserializeFromXml(parent, "includedFields");
     }
 }
コード例 #13
0
        public virtual void SerializeToXml(XmlProxy xmlRoot)
        {
            xmlRoot.AddAttribute("valueType", ValueType);

            if (CanSerializeValue())
            {
                SerializeValueToXml(xmlRoot);
            }
        }
コード例 #14
0
        public void SerializeToXml(XmlWriter writer, string propertyName)
        {
            XmlProxy xmlRoot = new XmlProxy(propertyName);

            xmlRoot.AddAttribute("getter", this.Getter);
            xmlRoot.AddAttribute("setter", this.Setter);

            XmlProxySerializer.Instance.Serialize(xmlRoot, writer);
        }
コード例 #15
0
        protected override void InternalSerializeToXml(XmlProxy xmlRoot)
        {
            //xmlRoot.AddAttribute("isReference", IsReference);
            var xmlisReference = xmlRoot.AddChild("isReference");

            this.IsReference.SerializeToXml(xmlisReference);

            xmlRoot.AddAttribute("namespace", this.Namespace);
        }
コード例 #16
0
        protected override void DeserializeValueFromXml(XmlProxy parent)
        {
            XmlProxy xmlContent = parent["content"];

            this.Default = xmlContent.GetAttr("default", false);

            this.Value = new ObjectValue();
            this.Value.DeserializeFromXml(xmlContent, "value");
        }
コード例 #17
0
        /// <summary>
        /// Set child value.
        /// </summary>
        /// <param name="ChildElementName">Child element name.</param>
        /// <param name="ChildElementValue"><see cref="Guid"/> value.</param>
        public void SetChildValue(string ChildElementName, Guid ChildElementValue)
        {
            XmlProxy item = mChilds[ChildElementName];

            if (item != null)
            {
                item.ElementValue = ChildElementValue.ToString();
            }
        }
コード例 #18
0
 public void SerializeToXml(XmlProxy xmlRoot)
 {
     foreach (PropertyConstraint constraint in AllConstraints)
     {
         XmlProxy xmlConstraint = xmlRoot.AddChild("constraint");
         xmlConstraint.AddAttribute("type", constraint.ConstrainType);
         constraint.SerializeToXml(xmlConstraint);
     }
 }
コード例 #19
0
        public void DeserializeFromXml(XmlReader reader, string propertyName)
        {
            XmlProxy xmlRoot = XmlProxySerializer.Instance.Deserialize(reader);

            if (xmlRoot.ElementName == propertyName)
            {
                DeserializeFromXml(xmlRoot);
            }
        }
コード例 #20
0
        public void DeserializeFromXml(XmlReader reader, string propertyName)
        {
            XmlProxy xmlRoot = XmlProxySerializer.Instance.Deserialize(reader);

            if (xmlRoot.ElementName == propertyName)
            {
                this.Getter = (PropertyAccessModifier)xmlRoot.GetAttr("getter", (int)PropertyAccessModifier.Public);
                this.Setter = (PropertyAccessModifier)xmlRoot.GetAttr("setter", (int)PropertyAccessModifier.Public);
            }
        }
コード例 #21
0
        /// <summary>
        /// Get child value.
        /// </summary>
        /// <param name="ChildElementName">Child element name.</param>
        /// <returns>
        /// Returns child value as <see cref="System.String"/>
        /// </returns>
        public string GetChildValue(string ChildElementName)
        {
            XmlProxy item = mChilds[ChildElementName];

            if ((item != null) && (item.ElementValue != null))
            {
                return(item.ElementValue);
            }
            return(string.Empty);
        }
コード例 #22
0
        protected override void InternalDeserializeFromXml(XmlProxy xmlRoot)
        {
            //this.IsReference = xmlRoot.GetAttr("isReference", false);
            var xmlisReference = xmlRoot["isReference"];

            this.IsReference = new Defaultable <bool>();
            this.IsReference.DeserializeFromXml(xmlisReference);

            this.Namespace = xmlRoot.GetAttr("namespace");
        }
コード例 #23
0
        protected override void InternalSerializeToXml(XmlProxy content)
        {
            XmlProxy minXml = content.AddChild("min");

            this.Min.SerializeToXml(minXml);

            XmlProxy maxXml = content.AddChild("max");

            this.Max.SerializeToXml(maxXml);
        }
コード例 #24
0
        protected override void SerializeValueToXml(XmlProxy parent)
        {
            XmlProxy xmlDirection = parent.AddChild("direction");

            this.Direction.SerializeToXml(xmlDirection);

            XmlProxy xmlPosition = parent.AddChild("position");

            this.Position.SerializeToXml(xmlPosition);
        }
コード例 #25
0
        protected override void DeserializeValueFromXml(XmlProxy parent)
        {
            XmlProxy elementValue = parent["value"];

            string kind = elementValue.GetAttr("kind");

            this.Kind = (KeyGeneratorKind)Enum.Parse(typeof(KeyGeneratorKind), kind, true);

            this.Name = elementValue.GetAttr("name");
            this.Type = elementValue.GetAttr("type");
        }
コード例 #26
0
        protected override void InternalDeserializeFromXml(XmlProxy content)
        {
            XmlProxy minXml = content.Childs["min"];
            XmlProxy maxXml = content.Childs["max"];

            this.Min = new ObjectValueInfo();
            this.Min.DeserializeFromXml(minXml);

            this.Max = new ObjectValueInfo();
            this.Max.DeserializeFromXml(maxXml);
        }
コード例 #27
0
        protected override void DeserializeValueFromXml(XmlProxy parent)
        {
            XmlProxy xmlDirection = parent["direction"];

            this.Direction = new Defaultable <KeyDirection>();
            this.Direction.DeserializeFromXml(xmlDirection);

            XmlProxy xmlPosition = parent["position"];

            this.Position = new Defaultable <int>();
            this.Position.DeserializeFromXml(xmlPosition);
        }
コード例 #28
0
        /// <summary>
        /// Clones <see cref="XmlProxy"/> object
        /// </summary>
        /// <returns>Cloned <see cref="XmlProxy"/> object.</returns>
        public XmlProxy Clone()
        {
            XmlProxy cloned = new XmlProxy(ElementName, ElementValue);

            cloned.Tag        = Tag;
            cloned.Attributes = Attributes.Clone();
            foreach (XmlProxy child in Childs)
            {
                cloned.AddChild(child.Clone());
            }

            return(cloned);
        }
コード例 #29
0
        /// <summary>
        /// Get child value.
        /// </summary>
        /// <param name="ChildElementName">Child element name.</param>
        /// <returns>
        /// Returns child value as <see cref="System.Guid"/>
        /// </returns>
        public Guid GetChildValueGuid(string ChildElementName)
        {
            XmlProxy item = mChilds[ChildElementName];

            if ((item != null) && (item.ElementValue != null))
            {
                if (item.ElementValue.Length == 0)
                {
                    return(Guid.Empty);
                }
                return(new Guid(item.ElementValue));
            }
            return(Guid.Empty);
        }
コード例 #30
0
        protected override void SerializeValueToXml(XmlProxy parent)
        {
            XmlProxy elementValue = parent.AddChild("value");

            elementValue.SetAttr("inheritanceSchema", this.InheritanceSchema.ToString());

            XmlProxy elementIncludeTypeId = elementValue.AddChild("includeTypeId");

            IncludeTypeId.SerializeToXml(elementIncludeTypeId);

            XmlProxy xmlMappingName = elementValue.AddChild("mappingName");

            MappingName.SerializeToXml(xmlMappingName);
        }