Beispiel #1
0
        protected override void DeserializeValueFromXml(XmlProxy parent)
        {
            XmlProxy xmlContent = parent["content"];

            this.Name = xmlContent.GetAttr("name");
            InternalDeserializeFromXml(xmlContent);
        }
        public void SerializeToXml(XmlWriter writer, string propertyName)
        {
            XmlProxy xmlRoot = new XmlProxy(propertyName);

            SerializeToXml(xmlRoot);
            XmlProxySerializer.Instance.Serialize(xmlRoot, writer);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        public void SerializeToXml(XmlWriter writer)
        {
            XmlProxy xmlRoot = new XmlProxy("key");

            SerializeToXml(xmlRoot);
            XmlProxySerializer.Instance.Serialize(xmlRoot, writer);
        }
Beispiel #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;
            }
        }
Beispiel #6
0
        protected override void DeserializeValueFromXml(XmlProxy parent)
        {
            XmlProxy xmlContent = parent["content"];

            this.Value = new ObjectValue();
            this.Value.DeserializeFromXml(xmlContent, "value");
        }
Beispiel #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);
            }
        }
Beispiel #8
0
        protected override void SerializeValueToXml(XmlProxy parent)
        {
            XmlProxy xmlContent = parent.AddChild("content");

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

            SerializeToXml(xmlRoot);
            XmlProxySerializer.Instance.Serialize(xmlRoot, writer);
        }
        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);
        }
Beispiel #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");
        }
Beispiel #12
0
 public void DeserializeFromXml(XmlProxy parent)
 {
     if (parent.ElementName == "fields")
     {
         this.KeyFields.DeserializeFromXml(parent, "keyFields");
         this.IncludedFields.DeserializeFromXml(parent, "includedFields");
     }
 }
Beispiel #13
0
        public virtual void SerializeToXml(XmlProxy xmlRoot)
        {
            xmlRoot.AddAttribute("valueType", ValueType);

            if (CanSerializeValue())
            {
                SerializeValueToXml(xmlRoot);
            }
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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");
        }
Beispiel #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();
            }
        }
Beispiel #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);
     }
 }
Beispiel #19
0
        public void DeserializeFromXml(XmlReader reader, string propertyName)
        {
            XmlProxy xmlRoot = XmlProxySerializer.Instance.Deserialize(reader);

            if (xmlRoot.ElementName == propertyName)
            {
                DeserializeFromXml(xmlRoot);
            }
        }
Beispiel #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);
            }
        }
Beispiel #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);
        }
Beispiel #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");
        }
Beispiel #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);
        }
Beispiel #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);
        }
        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");
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
        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);
        }