private static void AddTypes(CodeNamespace codeNamespace, XmlSchemaSet schemaSet) { var schemas = new XmlSchemas(); foreach (var schema in schemaSet.Schemas().Cast <XmlSchema>()) { schemas.Add(schema); } var schemaImporter = new XmlSchemaImporter(schemas); #if NETFRAMEWORK schemaImporter.Extensions.Add(new NodaTimeSchemaImporterExtension()); var codeExporter = new XmlCodeExporter(codeNamespace); foreach (var schemaObject in schemas.SelectMany(e => e.Items.Cast <XmlSchemaObject>())) { XmlTypeMapping mapping; switch (schemaObject) { case XmlSchemaType schemaType: mapping = schemaImporter.ImportSchemaType(schemaType.QualifiedName); break; case XmlSchemaElement schemaElement: mapping = schemaImporter.ImportTypeMapping(schemaElement.QualifiedName); break; default: continue; } codeExporter.ExportTypeMapping(mapping); } CodeGenerator.ValidateIdentifiers(codeNamespace); #else throw new PlatformNotSupportedException($"{nameof(XmlCodeExporterAssemblyCreator)} is not available"); #endif }