Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        protected override void SerializeValueToXml(XmlProxy parent)
        {
            XmlProxy xmlContent = parent.AddChild("content");

            xmlContent.AddAttribute("name", Name);
            InternalSerializeToXml(xmlContent);
        }
Exemplo n.º 5
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");
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        protected override void InternalSerializeToXml(XmlProxy xmlRoot)
        {
            var xmlEmitDefaultValue = xmlRoot.AddChild("emitDefaultValue");

            EmitDefaultValue.SerializeToXml(xmlEmitDefaultValue);
            //xmlRoot.AddAttribute("emitDefaultValue", EmitDefaultValue);

            var xmlIsRequired = xmlRoot.AddChild("isRequired");

            IsRequired.SerializeToXml(xmlIsRequired);
            //xmlRoot.AddAttribute("isRequired", IsRequired);

            var xmlOrder = xmlRoot.AddChild("order");

            Order.SerializeToXml(xmlOrder);
            //xmlRoot.AddAttribute("order", Order);
        }
Exemplo n.º 8
0
 public void SerializeToXml(XmlProxy xmlRoot)
 {
     foreach (PropertyConstraint constraint in AllConstraints)
     {
         XmlProxy xmlConstraint = xmlRoot.AddChild("constraint");
         xmlConstraint.AddAttribute("type", constraint.ConstrainType);
         constraint.SerializeToXml(xmlConstraint);
     }
 }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
        public void SerializeToXml(XmlWriter writer, string propertyName)
        {
            XmlProxy xmlRoot = new XmlProxy(propertyName);

            xmlRoot.AddAttribute("multiplicity", multiplicity.ToString());
            xmlRoot.AddAttribute("onOwnerRemove", OnOwnerRemove.ToString());
            xmlRoot.AddAttribute("onTargetRemove", OnTargetRemove.ToString());
            xmlRoot.AddAttribute("useAssociationAttribute", this.UseAssociationAttribute);

            XmlProxy xmlPairTo = xmlRoot.AddChild("pairTo");

            this.PairTo.SerializeToXml(xmlPairTo);

            XmlProxySerializer.Instance.Serialize(xmlRoot, writer);
        }
Exemplo n.º 12
0
        protected override void SerializeValueToXml(XmlProxy parent)
        {
            XmlProxy xmlRoot = new XmlProxy("content");

            if (parent != null)
            {
                parent.AddChild(xmlRoot);
            }
            //xmlRoot.AddAttribute("type", this.ConstrainType);
            xmlRoot.AddAttribute("mode", this.Mode);
            XmlProxy xmlError = xmlRoot.AddChild("error");

            xmlError.AddAttribute("message", this.ErrorMessage);
            InternalSerializeToXml(xmlRoot);
        }
Exemplo n.º 13
0
        public void SerializeToXml(XmlProxy parent, string propertyName)
        {
            XmlProxy xmlRoot = parent.AddChild(propertyName);

            xmlRoot.AddAttribute("useCustomExpression", UseCustomExpression);
            XmlProxy xmlValue = xmlRoot.AddChild("Value");

            if (UseCustomExpression)
            {
                xmlValue.ElementValue = this.CustomExpression;
            }
            else if (Value != null)
            {
                xmlValue.AddAttribute("type", Value.GetType().AssemblyQualifiedName);
                xmlValue.ElementValue = SerializeValueToXml(Value);
            }
        }
Exemplo n.º 14
0
        protected override void SerializeValueToXml(XmlProxy parent)
        {
            object value       = InternalGetValue();
            string valueString = value == null ? string.Empty : InternalValueToString(value);
            //string valueString = value == null ? string.Empty : value.ToString();

            Type typeOfValue = GetTypeOfValue();

            if (typeOfValue.IsPrimitive)
            {
                parent.AddAttribute("value", valueString);
            }
            else
            {
//                if (typeOfValue == typeof(byte[]))
//                {
//                    valueString = Util.BytesToHexString((byte[]) value);
//                }

                XmlProxy xmlContent = parent.AddChild("value");
                xmlContent.ElementValue = valueString;
            }
        }
Exemplo n.º 15
0
        public XmlProxy Deserialize(XmlReader reader)
        {
            reader.MoveToContent();
            int    startDepth       = reader.Depth;
            string startElementName = reader.Name;

            Dictionary <int, List <XmlProxy> > items = new Dictionary <int, List <XmlProxy> >();
            XmlProxy lastProxy = null;

            bool readedOk = !reader.EOF;

            while ((readedOk) && (!reader.EOF))
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    XmlProxy        pi = new XmlProxy(reader.Name);
                    List <XmlProxy> al = items.SingleOrDefault(pair => pair.Key == reader.Depth).Value;
                    if (al == null)
                    {
                        al = new List <XmlProxy>();
                        items.Add(reader.Depth, al);
                        //items[reader.Depth] = al;
                    }
                    al.Add(pi);

                    // parent
                    List <XmlProxy> pal = items.SingleOrDefault(pair => pair.Key == (reader.Depth - 1)).Value;
                    if ((pal != null) && (pal.Count > 0))
                    {
                        XmlProxy parent = pal[pal.Count - 1];
                        if (parent != null)
                        {
                            parent.AddChild(pi);
                        }
                    }

                    // read attributes
                    if (reader.HasAttributes)
                    {
                        while (reader.MoveToNextAttribute())
                        {
                            pi.AddAttribute(reader.Name, reader.Value);
                        }
                    }

                    lastProxy = pi;

                    break;

                case XmlNodeType.Text:
                    if (lastProxy != null)
                    {
                        lastProxy.ElementValue = reader.Value;
                    }
                    break;

                case XmlNodeType.EndElement:
                    break;
                }

                readedOk = reader.Read();
                reader.MoveToContent();

                if (reader.NodeType == XmlNodeType.EndElement && reader.Name == startElementName && reader.Depth == startDepth)
                {
                    break;
                }
            }

            //reader.Close();

            if (items.Count > 0)
            {
                List <XmlProxy> firstProcyList = items.OrderBy(pair => pair.Key).Select(pair => pair.Value).First();

                //List<XmlProxy> al = items[0] as List<XmlProxy>;
                if ((firstProcyList != null) && (firstProcyList.Count > 0))
                {
                    return(firstProcyList[0]);
                }
            }

            return(null);
        }
Exemplo n.º 16
0
        public override void SerializeToXml(XmlWriter writer)
        {
            XmlProxy xmlRoot = new XmlProxy("field");

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

            this.MappingName.SerializeToXml(xmlMappingName);

            XmlProxy xmlIndexed = xmlRoot.AddChild("indexed");

            this.Indexed.SerializeToXml(xmlIndexed);

            XmlProxy xmlLazyLoad = xmlRoot.AddChild("lazyLoad");

            this.LazyLoad.SerializeToXml(xmlLazyLoad);

            XmlProxy xmlLength = xmlRoot.AddChild("length");

            this.Length.SerializeToXml(xmlLength);

            XmlProxy xmlNullable = xmlRoot.AddChild("nullable");

            this.Nullable.SerializeToXml(xmlNullable);

            XmlProxy xmlNullableOnUpgrade = xmlRoot.AddChild("nullableOnUpgrade");

            this.NullableOnUpgrade.SerializeToXml(xmlNullableOnUpgrade);

            XmlProxy xmlPrecision = xmlRoot.AddChild("precision");

            this.Precision.SerializeToXml(xmlPrecision);

            XmlProxy xmlScale = xmlRoot.AddChild("scale");

            this.Scale.SerializeToXml(xmlScale);

            XmlProxy xmlTypeDiscriminator = xmlRoot.AddChild("typeDiscriminator");

            this.TypeDiscriminator.SerializeToXml(xmlTypeDiscriminator);

            XmlProxy xmlVersion = xmlRoot.AddChild("version");

            this.Version.SerializeToXml(xmlVersion);

            XmlProxy xmlDefaultValue = xmlRoot.AddChild("defaultValue");

            this.DefaultValue.SerializeToXml(xmlDefaultValue);

            XmlProxySerializer.Instance.Serialize(xmlRoot, writer);
        }