12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System;
- namespace Wayne.ForecourtControl
- {
- /// <summary>
- /// Xml serialization support class.
- /// </summary>
- public static class ForecourtControlXml
- {
- #region Fields
- private static System.Xml.Schema.XmlSchema schema;
- #endregion
- #region Properties
- /// <summary>
- /// Namespace for Forecourt control.
- /// </summary>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1706:ShortAcronymsShouldBeUppercase", MessageId = "Member")]
- public const string Ns = "http://www.wayne.com/2006-08-14/ForecourtControl.xsd";
- #endregion
- #region Methods
- /// <summary>
- /// Adds the internal schemas to an xml schema set object.
- /// </summary>
- /// <param name="xmlSchemaSet"></param>
- public static void AddSchemas(System.Xml.Schema.XmlSchemaSet xmlSchemaSet)
- {
- schema = null; // MLA: DON'T CACHE
- if (schema == null)
- {
- string schemaName = "Wayne.ForecourtControl.ForecourtControl.xsd";
- using (var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(schemaName))
- {
- schema = System.Xml.Schema.XmlSchema.Read(stream, null);
- }
- if (schema == null)
- throw new NullReferenceException(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Embedded resource XML-schema \"{0}\" not found!", ForecourtControlXml.Ns));
- }
- if (xmlSchemaSet != null)
- {
- if (!xmlSchemaSet.Contains(schema.TargetNamespace))
- xmlSchemaSet.Add(schema);
- }
- }
- #endregion
- }
- }
|