bool InternalCanImport(XmlSchemaSet schemas, ICollection<XmlQualifiedName> typeNames, ICollection<XmlSchemaElement> elements, XmlQualifiedName[] elementTypeNames) { DataContractSet oldValue = (dataContractSet == null) ? null : new DataContractSet(dataContractSet); try { SchemaImporter schemaImporter = new SchemaImporter(schemas, typeNames, elements, elementTypeNames, DataContractSet, ImportXmlDataType); schemaImporter.Import(); return true; } catch (InvalidDataContractException) { dataContractSet = oldValue; return false; } catch (Exception ex) { if (Fx.IsFatal(ex)) { throw; } dataContractSet = oldValue; TraceImportError(ex); throw; } }
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)); } }