protected override void BeginNamespace () { xmlImporter = new XmlSchemaImporter (LiteralSchemas, ClassNames); soapImporter = new SoapSchemaImporter (EncodedSchemas, ClassNames); xmlExporter = new XmlCodeExporter (CodeNamespace, null); xmlReflectionImporter = new XmlReflectionImporter (); }
protected override void BeginNamespace () { #if NET_2_0 xmlImporter = new XmlSchemaImporter (LiteralSchemas, base.CodeGenerationOptions, base.CodeGenerator, base.ImportContext); soapImporter = new SoapSchemaImporter (EncodedSchemas, base.CodeGenerationOptions, base.CodeGenerator, base.ImportContext); xmlExporter = new XmlCodeExporter (CodeNamespace, null, base.CodeGenerator, base.CodeGenerationOptions, null); soapExporter = new SoapCodeExporter (CodeNamespace, null, base.CodeGenerator, base.CodeGenerationOptions, null); #else xmlImporter = new XmlSchemaImporter (LiteralSchemas, ClassNames); soapImporter = new SoapSchemaImporter (EncodedSchemas, ClassNames); xmlExporter = new XmlCodeExporter (CodeNamespace, null); soapExporter = new SoapCodeExporter (CodeNamespace, null); #endif }
protected override void BeginNamespace() { try { base.MethodNames.Clear(); base.ExtraCodeClasses.Clear(); this.soapImporter = new SoapSchemaImporter(base.AbstractSchemas, base.ServiceImporter.CodeGenerationOptions, base.ImportContext); this.xmlImporter = new XmlSchemaImporter(base.ConcreteSchemas, base.ServiceImporter.CodeGenerationOptions, base.ServiceImporter.CodeGenerator, base.ImportContext); foreach (Type type in base.ServiceImporter.Extensions) { this.xmlImporter.Extensions.Add(type.FullName, type); } this.xmlImporter.Extensions.Add(TypedDataSetSchemaImporterExtension); this.xmlImporter.Extensions.Add(new DataSetSchemaImporterExtension()); this.xmlExporter = new XmlCodeExporter(base.CodeNamespace, base.ServiceImporter.CodeCompileUnit, base.ServiceImporter.CodeGenerator, base.ServiceImporter.CodeGenerationOptions, base.ExportContext); this.soapExporter = new SoapCodeExporter(base.CodeNamespace, null, base.ServiceImporter.CodeGenerator, base.ServiceImporter.CodeGenerationOptions, base.ExportContext); } catch (Exception exception) { if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException)) { throw; } throw new InvalidOperationException(System.Web.Services.Res.GetString("InitFailed"), exception); } }
public XmlSerializerSchemaImporter(WsdlImporter importer) : base(importer) { XmlSerializerImportOptions options; if (importer.State.ContainsKey(typeof(XmlSerializerImportOptions))) { options = (XmlSerializerImportOptions)importer.State[typeof(XmlSerializerImportOptions)]; } else { object compileUnit; if (!importer.State.TryGetValue(typeof(CodeCompileUnit), out compileUnit)) { compileUnit = new CodeCompileUnit(); importer.State.Add(typeof(CodeCompileUnit), compileUnit); } options = new XmlSerializerImportOptions((CodeCompileUnit)compileUnit); importer.State.Add(typeof(XmlSerializerImportOptions), options); } WsdlNS.WebReferenceOptions webReferenceOptions = options.WebReferenceOptions; codeProvider = options.CodeProvider; encodedSchemas = new XmlSchemas(); literalSchemas = new XmlSchemas(); CollectEncodedAndLiteralSchemas(importer.WsdlDocuments, encodedSchemas, literalSchemas, schemaSet); CodeIdentifiers codeIdentifiers = new CodeIdentifiers(); //SchemaImporter.ctor is not thread safe: MB49115, VSWhidbey580396 lock (schemaImporterLock) { xmlImporter = new XmlSchemaImporter(literalSchemas, webReferenceOptions.CodeGenerationOptions, options.CodeProvider, new ImportContext(codeIdentifiers, false)); } if (webReferenceOptions != null) { foreach (string extTypeName in webReferenceOptions.SchemaImporterExtensions) { xmlImporter.Extensions.Add(extTypeName, Type.GetType(extTypeName, true /*throwOnError*/)); } } //SchemaImporter.ctor is not thread safe: MB49115, VSWhidbey580396 lock (schemaImporterLock) { soapImporter = new SoapSchemaImporter(encodedSchemas, webReferenceOptions.CodeGenerationOptions, options.CodeProvider, new ImportContext(codeIdentifiers, false)); } xmlSerializerOperationGenerator = new XmlSerializerOperationGenerator(options); }
/// <include file='doc\SoapProtocolImporter.uex' path='docs/doc[@for="SoapProtocolImporter.BeginNamespace"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> protected override void BeginNamespace() { try { MethodNames.Clear(); ExtraCodeClasses.Clear(); soapImporter = new SoapSchemaImporter(AbstractSchemas, ServiceImporter.CodeGenerationOptions, ImportContext); xmlImporter = new XmlSchemaImporter(ConcreteSchemas, ServiceImporter.CodeGenerationOptions, ServiceImporter.CodeGenerator, ImportContext); foreach (Type extensionType in ServiceImporter.Extensions) { xmlImporter.Extensions.Add(extensionType.FullName, extensionType); } // use cached version of typed DataSetSchemaImporterExtension for /sharetypes feature // xmlImporter.Extensions.Add(TypedDataSetSchemaImporterExtension); xmlImporter.Extensions.Add(new DataSetSchemaImporterExtension()); xmlExporter = new XmlCodeExporter(this.CodeNamespace, ServiceImporter.CodeCompileUnit, ServiceImporter.CodeGenerator, ServiceImporter.CodeGenerationOptions, ExportContext); soapExporter = new SoapCodeExporter(this.CodeNamespace, null, ServiceImporter.CodeGenerator, ServiceImporter.CodeGenerationOptions, ExportContext); } catch (Exception e) { if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException) { throw; } throw new InvalidOperationException(Res.GetString(Res.InitFailed), e); } }