Ejemplo n.º 1
0
        /// <summary>
        ///     Generates a new XmlSchema object from the <see cref="_configType" /> object
        /// </summary>
        public XmlSchema GenerateXsd(string rootElementName)
        {
            _rootElement = CreateRootElement(rootElementName);
            var rootCt = (XmlSchemaComplexType)_schemaDoc.Items[0];

            //  get all properties from the configuration object
            var properties = TypeParser.GetProperties <ConfigurationPropertyAttribute>(_configType);

            foreach (var pi in properties)
            {
                Debug.IndentLevel = 0;
                Debug.WriteLine("ConfigurationProperty: " + pi.Name);

                var parser = TypeParserFactory.GetParser(this, pi);
                parser.GenerateSchemaTypeObjects(pi, rootCt, 0);
            }

            return(_schemaDoc);
        }