void InternalImport(XmlSchemaSet schemas, ICollection <XmlQualifiedName> typeNames, ICollection <XmlSchemaElement> elements, XmlQualifiedName[] elementTypeNames /*filled on return*/) { if (DiagnosticUtility.ShouldTraceInformation) { TraceUtility.Trace(TraceEventType.Information, TraceCode.XsdImportBegin, SR.GetString(SR.TraceCodeXsdImportBegin)); } DataContractSet oldValue = (dataContractSet == null) ? null : new DataContractSet(dataContractSet); try { SchemaImporter schemaImporter = new SchemaImporter(schemas, typeNames, elements, elementTypeNames /*filled on return*/, DataContractSet, ImportXmlDataType); schemaImporter.Import(); CodeExporter codeExporter = new CodeExporter(DataContractSet, Options, GetCodeCompileUnit()); codeExporter.Export(); } catch (Exception ex) { if (Fx.IsFatal(ex)) { throw; } dataContractSet = oldValue; TraceImportError(ex); throw; } if (DiagnosticUtility.ShouldTraceInformation) { TraceUtility.Trace(TraceEventType.Information, TraceCode.XsdImportEnd, SR.GetString(SR.TraceCodeXsdImportEnd)); } }
private IList <XmlQualifiedName>?InternalImport(XmlSchemaSet schemas, ICollection <XmlQualifiedName>?typeNames, ICollection <XmlSchemaElement>?elements) { DataContractSet? oldValue = (_dataContractSet == null) ? null : new DataContractSet(_dataContractSet); IList <XmlQualifiedName>?elementTypeNames = null; try { if (elements != null) { elementTypeNames = DataContractSet.ImportSchemaSet(schemas, elements, ImportXmlDataType); } else { DataContractSet.ImportSchemaSet(schemas, typeNames, ImportXmlDataType); } CodeExporter codeExporter = new CodeExporter(DataContractSet, Options, CodeCompileUnit); codeExporter.Export(); return(elementTypeNames); } catch (Exception ex) { if (Fx.IsFatal(ex)) { throw; } _dataContractSet = oldValue; throw; } }
private void InternalImport(XmlSchemaSet schemas, ICollection <XmlQualifiedName> typeNames, ICollection <XmlSchemaElement> elements, XmlQualifiedName[] elementTypeNames /*filled on return*/) { DataContractSet oldValue = (_dataContractSet == null) ? null : new DataContractSet(_dataContractSet); try { SchemaImporter schemaImporter = new SchemaImporter(schemas, typeNames, elements, elementTypeNames /*filled on return*/, DataContractSet, ImportXmlDataType); schemaImporter.Import(); CodeExporter codeExporter = new CodeExporter(DataContractSet, Options, GetCodeCompileUnit()); codeExporter.Export(); } catch (Exception ex) { if (DiagnosticUtility.IsFatal(ex)) { throw; } _dataContractSet = oldValue; TraceImportError(ex); throw; } }