System.Runtime.Serialization.XsdDataContractImporter.Import C# (CSharp) Method

Import() public method

public Import ( XmlSchemaSet schemas, XmlQualifiedName typeName ) : void
schemas System.Xml.Schema.XmlSchemaSet
typeName System.Xml.XmlQualifiedName
return void
		public void Import (XmlSchemaSet schemas, XmlQualifiedName typeName)
		{
			if (schemas == null)
				throw new ArgumentNullException ("schemas");
			if (typeName == null)
				throw new ArgumentNullException ("typeName");

			if (IsPredefinedType (typeName))
				return;

			if (!schemas.GlobalTypes.Contains (typeName))
				throw new InvalidDataContractException (String.Format ("Type {0} is not found in the schemas", typeName));

			Import (schemas, schemas.GlobalTypes [typeName] as XmlSchemaType, typeName);
		}

Same methods

XsdDataContractImporter::Import ( XmlSchemaSet schemas, XmlSchemaElement element ) : XmlQualifiedName
XsdDataContractImporter::Import ( XmlSchemaSet schemas ) : void
XsdDataContractImporter::Import ( XmlSchemaSet schemas, ICollection typeNames ) : void
XsdDataContractImporter::Import ( XmlSchemaSet schemas, XmlSchemaType type ) : void
XsdDataContractImporter::Import ( XmlSchemaSet schemas, XmlSchemaType type, XmlQualifiedName qname ) : void

Usage Example

コード例 #1
0
		void IWsdlImportExtension.ImportContract (WsdlImporter importer,
			WsdlContractConversionContext context)
		{
			if (!enabled)
				return;

			if (importer == null)
				throw new ArgumentNullException ("importer");
			if (context == null)
				throw new ArgumentNullException ("context");
			if (this.importer != null || this.context != null)
				throw new SystemException ("INTERNAL ERROR: unexpected recursion of ImportContract method call");

			dc_importer = new XsdDataContractImporter ();
			schema_set_in_use = new XmlSchemaSet ();
			schema_set_in_use.Add (importer.XmlSchemas);
			foreach (WSDL wsdl in importer.WsdlDocuments)
				foreach (XmlSchema xs in wsdl.Types.Schemas)
					schema_set_in_use.Add (xs);
			dc_importer.Import (schema_set_in_use);

			this.importer = importer;
			this.context = context;
			try {
				DoImportContract ();
			} finally {
				this.importer = null;
				this.context = null;
			}
		}
All Usage Examples Of System.Runtime.Serialization.XsdDataContractImporter::Import