コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
        MessageContractImporter(WsdlImporter importer, WsdlContractConversionContext contractContext, SchemaImporter schemaImporter)
        {
            this.contractContext = contractContext;
            this.importer = importer;
            this.allSchemas = GatherSchemas(importer);
            this.schemaImporter = schemaImporter;

            object faultImportOptions;
            if (this.importer.State.TryGetValue(typeof(FaultImportOptions), out faultImportOptions))
                this.faultImportOptions = (FaultImportOptions)faultImportOptions;
            else
                this.faultImportOptions = new FaultImportOptions();
        }
コード例 #5
0
 static internal void ImportMessageContract(WsdlImporter importer, WsdlContractConversionContext contractContext, SchemaImporter schemaImporter)
 {
     new MessageContractImporter(importer, contractContext, schemaImporter).ImportMessageContract();
 }