private bool InternalCanImport(XmlSchemaSet schemas, ICollection <XmlQualifiedName>?typeNames, ICollection <XmlSchemaElement>?elements) { DataContractSet?oldValue = (_dataContractSet == null) ? null : new DataContractSet(_dataContractSet); try { if (elements != null) { DataContractSet.ImportSchemaSet(schemas, elements, ImportXmlDataType); } else { DataContractSet.ImportSchemaSet(schemas, typeNames, ImportXmlDataType); } return(true); } catch (InvalidDataContractException) { _dataContractSet = oldValue; return(false); } catch (Exception ex) { if (Fx.IsFatal(ex)) { throw; } _dataContractSet = oldValue; throw; } }
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; } }