Export (0) Print
Expand All

XsdDataContractImporter Class

Allows the transformation of a set of XML schema files (.xsd) into common language runtime (CLR) types.

System::Object
  System.Runtime.Serialization::XsdDataContractImporter

Namespace:  System.Runtime.Serialization
Assembly:  System.Runtime.Serialization (in System.Runtime.Serialization.dll)

public ref class XsdDataContractImporter

The XsdDataContractImporter type exposes the following members.

  NameDescription
Public methodXsdDataContractImporter()Initializes a new instance of the XsdDataContractImporter class.
Public methodXsdDataContractImporter(CodeCompileUnit)Initializes a new instance of the XsdDataContractImporter class with the CodeCompileUnit that will be used to generate CLR code.
Top

  NameDescription
Public propertyCodeCompileUnitGets a CodeCompileUnit used for storing the CLR types generated.
Public propertyOptionsGets or sets an ImportOptions that contains settable options for the import operation.
Top

  NameDescription
Public methodCanImport(XmlSchemaSet)Gets a value that indicates whether the schemas contained in an XmlSchemaSet can be transformed into a CodeCompileUnit.
Public methodCanImport(XmlSchemaSet, ICollection<XmlQualifiedName>)Gets a value that indicates whether the specified set of types contained in an XmlSchemaSet can be transformed into CLR types generated into a CodeCompileUnit.
Public methodCanImport(XmlSchemaSet, XmlSchemaElement)Gets a value that indicates whether a specific schema element contained in an XmlSchemaSet can be imported.
Public methodCanImport(XmlSchemaSet, XmlQualifiedName)Gets a value that indicates whether the schemas contained in an XmlSchemaSet can be transformed into a CodeCompileUnit.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetCodeTypeReference(XmlQualifiedName)Returns a CodeTypeReference to the CLR type generated for the schema type with the specified XmlQualifiedName.
Public methodGetCodeTypeReference(XmlQualifiedName, XmlSchemaElement)Returns a CodeTypeReference for the specified XML qualified element and schema element.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetKnownTypeReferencesReturns a list of CodeTypeReference objects that represents the known types generated when generating code for the specified schema type.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodImport(XmlSchemaSet)Transforms the specified set of XML schemas contained in an XmlSchemaSet into a CodeCompileUnit.
Public methodImport(XmlSchemaSet, ICollection<XmlQualifiedName>)Transforms the specified set of schema types contained in an XmlSchemaSet into CLR types generated into a CodeCompileUnit.
Public methodImport(XmlSchemaSet, XmlSchemaElement)Transforms the specified schema element in the set of specified XML schemas into a CodeCompileUnit and returns an XmlQualifiedName that represents the data contract name for the specified element.
Public methodImport(XmlSchemaSet, XmlQualifiedName)Transforms the specified XML schema type contained in an XmlSchemaSet into a CodeCompileUnit.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

Use the XsdDataContractImporter if you are creating a Web service that must interoperate with an existing Web service, or to create data contract types from XML schemas. XsdDataContractImporter will transform a set of XML schemas and create the .NET Framework types that represent the data contract in a selected programming language. To create the code, use the classes in the System.CodeDom namespace.

Conversely, use the XsdDataContractExporter class when you have created a Web service that incorporates data represented by CLR types and when you need to export XML schemas for each data type to be consumed by other Web services. That is, XsdDataContractExporter transforms a set of CLR types into a set of XML schemas.

NoteNote

To generate CLR types from XML schemas at design time, use the ServiceModel Metadata Utility Tool (Svcutil.exe). To generated code from XSD files, use the /dataContractOnly switch of the tool. You can also use the XsdDataContractImporter if you need more control over the process or need to do it programmatically.

The following example creates an XmlSchemaSet and calls the Import method to create a CodeCompileUnit. The CodeCompileUnit is then used to create both Visual C# and Visual Basic code files.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft