using System; namespace Wayne.ForecourtControl { /// /// Xml serialization support class. /// public static class ForecourtControlXml { #region Fields private static System.Xml.Schema.XmlSchema schema; #endregion #region Properties /// /// Namespace for Forecourt control. /// [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 /// /// Adds the internal schemas to an xml schema set object. /// /// 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 } }