Exemplo n.º 1
0
        public XmlNode SerializeToXmlNode(XmlDocument xmlDoc, MarshalParameter marshalParameter)
        {
            XmlNode      xml = xmlDoc.CreateElement("parameter");
            XmlAttribute xmlAttr;

            xmlAttr       = xmlDoc.CreateAttribute("name");
            xmlAttr.Value = marshalParameter.Name;
            xml.Attributes.Append(xmlAttr);

            xmlAttr       = xmlDoc.CreateAttribute("type");
            xmlAttr.Value = marshalParameter.DbType.ToString();
            xml.Attributes.Append(xmlAttr);

            //TODO: Ref values
            XmlNode xmlValue = xmlDoc.CreateElement("query-string");

            xmlValue.InnerText = marshalParameter.Value;
            xml.AppendChild(xmlValue);

            return(xml);
        }
Exemplo n.º 2
0
        private MarshalParameter ToMarshalParameter(XmlNode xmlParam)
        {
            MarshalParameter mp = new MarshalParameter();

            if (!(xmlParam.Attributes["name"] == null))
            {
                mp.Name = xmlParam.Attributes["name"].Value;
            }
            if (!(xmlParam.Attributes["type"] == null))
            {
                mp.DbType = (DbType)Enum.Parse(typeof(DbType), xmlParam.Attributes["type"].Value);
            }

            XmlNode xmlNode = xmlParam.SelectSingleNode("value");

            if (xmlNode != null)
            {
                mp.Value = xmlNode.InnerText;
            }

            return(mp);
        }