Пример #1
0
        /// <summary>
        /// Serializes this instance to the specified XML writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="rootElementName">Name of the root element.</param>
        public void ToXml(XmlWriter writer, string rootElementName)
        {
            IgniteArgumentCheck.NotNull(writer, "writer");
            IgniteArgumentCheck.NotNullOrEmpty(rootElementName, "rootElementName");

            IgniteConfigurationXmlSerializer.Serialize(this, writer, rootElementName);
        }
        /// <summary>
        /// Checks the schema validation.
        /// </summary>
        private static void CheckSchemaValidation()
        {
            var sb = new StringBuilder();

            using (var xmlWriter = XmlWriter.Create(sb))
            {
                IgniteConfigurationXmlSerializer.Serialize(GetTestConfig(), xmlWriter, "igniteConfiguration");
            }

            CheckSchemaValidation(sb.ToString());
        }
        /// <summary>
        /// Serializes and deserializes a config.
        /// </summary>
        private static IgniteConfiguration SerializeDeserialize(IgniteConfiguration cfg)
        {
            var sb = new StringBuilder();

            using (var xmlWriter = XmlWriter.Create(sb))
            {
                IgniteConfigurationXmlSerializer.Serialize(cfg, xmlWriter, "igniteConfig");
            }

            var xml = sb.ToString();

            using (var xmlReader = XmlReader.Create(new StringReader(xml)))
            {
                xmlReader.MoveToContent();
                return(IgniteConfigurationXmlSerializer.Deserialize(xmlReader));
            }
        }
Пример #4
0
        /// <summary>
        /// Creates an XML string containing an unmerged view of the <see cref="ConfigurationSection" />
        /// object as a single section to write to a file.
        /// </summary>
        /// <param name="parentElement">The <see cref="ConfigurationElement" />
        /// instance to use as the parent when performing the un-merge.</param>
        /// <param name="name">The name of the section to create.</param>
        /// <param name="saveMode">The <see cref="ConfigurationSaveMode" /> instance
        /// to use when writing to a string.</param>
        /// <returns>
        /// An XML string containing an unmerged view of the <see cref="ConfigurationSection" /> object.
        /// </returns>
        protected override string SerializeSection(ConfigurationElement parentElement, string name,
                                                   ConfigurationSaveMode saveMode)
        {
            IgniteArgumentCheck.NotNull(parentElement, "parentElement");
            IgniteArgumentCheck.NotNullOrEmpty(name, "name");

            if (IgniteConfiguration == null)
            {
                return(string.Format("<{0} />", name));
            }

            var sb = new StringBuilder();

            using (var xmlWriter = XmlWriter.Create(sb))
            {
                IgniteConfigurationXmlSerializer.Serialize(IgniteConfiguration, xmlWriter, name);

                return(sb.ToString());
            }
        }
Пример #5
0
 /// <summary>
 /// Serializes this instance to an XML string.
 /// </summary>
 public string ToXml()
 {
     return(IgniteConfigurationXmlSerializer.Serialize(this, "igniteClientConfiguration"));
 }
Пример #6
0
 /// <summary>
 /// Serializes this instance to the specified XML writer.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="rootElementName">Name of the root element.</param>
 public void ToXml(XmlWriter writer, string rootElementName)
 {
     IgniteConfigurationXmlSerializer.Serialize(this, writer, rootElementName);
 }