XsdDataContractImporter.Import Método

Definición

Transforma un conjunto de esquemas XML en CodeCompileUnit usado para generar código de CLR.

Sobrecargas

Import(XmlSchemaSet)

Transforma el conjunto especificado de esquemas XML incluido en un XmlSchemaSet en una CodeCompileUnit.

Import(XmlSchemaSet, ICollection<XmlQualifiedName>)

Transforma el conjunto especificado de tipos de esquema incluido en la clase XmlSchemaSet en los tipos de CLR generados en la clase CodeCompileUnit.

Import(XmlSchemaSet, XmlSchemaElement)

Transforma el elemento de esquema especificado en el conjunto de esquemas XML especificados en CodeCompileUnit y devuelve XmlQualifiedName que representa el nombre de contrato de datos para el elemento especificado.

Import(XmlSchemaSet, XmlQualifiedName)

Transforma el tipo de esquema XML especificado incluido en XmlSchemaSet en CodeCompileUnit.

Import(XmlSchemaSet)

Transforma el conjunto especificado de esquemas XML incluido en un XmlSchemaSet en una CodeCompileUnit.

public:
 void Import(System::Xml::Schema::XmlSchemaSet ^ schemas);
public void Import (System.Xml.Schema.XmlSchemaSet schemas);
member this.Import : System.Xml.Schema.XmlSchemaSet -> unit
Public Sub Import (schemas As XmlSchemaSet)

Parámetros

schemas
XmlSchemaSet

Un XmlSchemaSet que contiene las representaciones de esquema para generar los tipos de CLR.

Excepciones

El parámetro schemas es null.

Ejemplos

En el ejemplo siguiente se usa el método CanImport para probar si se puede importar un conjunto de esquemas. Si el método CanImport devuelve true, el código invoca el método Import.

static CodeCompileUnit Import(XmlSchemaSet schemas)
{

    XsdDataContractImporter imp = new XsdDataContractImporter();

    // The EnableDataBinding option adds a RaisePropertyChanged method to
    // the generated code. The GenerateInternal causes code access to be
    // set to internal.
    ImportOptions iOptions = new ImportOptions();
    iOptions.EnableDataBinding = true;
    iOptions.GenerateInternal = true;
    imp.Options = iOptions;

    if (imp.CanImport(schemas))
    {
        imp.Import(schemas);
        return imp.CodeCompileUnit;
    }
    else
    {
        return null;
    }
}
Shared Function Import(ByVal schemas As XmlSchemaSet) As CodeCompileUnit 

    Dim imp As New XsdDataContractImporter()
   ' The EnableDataBinding option adds a RaisePropertyChanged method to
   ' the generated code. The GenerateInternal causes code access to be
   ' set to internal.
   Dim iOptions As New ImportOptions()
   iOptions.EnableDataBinding = true
   iOptions.GenerateInternal = true
   imp.Options = IOptions

    If imp.CanImport(schemas) Then
        imp.Import(schemas)
        Return imp.CodeCompileUnit
    Else
        Return Nothing
    End If
End Function

Se aplica a

Import(XmlSchemaSet, ICollection<XmlQualifiedName>)

Transforma el conjunto especificado de tipos de esquema incluido en la clase XmlSchemaSet en los tipos de CLR generados en la clase CodeCompileUnit.

public:
 void Import(System::Xml::Schema::XmlSchemaSet ^ schemas, System::Collections::Generic::ICollection<System::Xml::XmlQualifiedName ^> ^ typeNames);
public void Import (System.Xml.Schema.XmlSchemaSet schemas, System.Collections.Generic.ICollection<System.Xml.XmlQualifiedName> typeNames);
member this.Import : System.Xml.Schema.XmlSchemaSet * System.Collections.Generic.ICollection<System.Xml.XmlQualifiedName> -> unit
Public Sub Import (schemas As XmlSchemaSet, typeNames As ICollection(Of XmlQualifiedName))

Parámetros

schemas
XmlSchemaSet

Un XmlSchemaSet que contiene las representaciones del esquema.

typeNames
ICollection<XmlQualifiedName>

ICollection<T> (de XmlQualifiedName) que representa el conjunto de tipos de esquema para importar.

Se aplica a

Import(XmlSchemaSet, XmlSchemaElement)

Transforma el elemento de esquema especificado en el conjunto de esquemas XML especificados en CodeCompileUnit y devuelve XmlQualifiedName que representa el nombre de contrato de datos para el elemento especificado.

public:
 System::Xml::XmlQualifiedName ^ Import(System::Xml::Schema::XmlSchemaSet ^ schemas, System::Xml::Schema::XmlSchemaElement ^ element);
public System.Xml.XmlQualifiedName Import (System.Xml.Schema.XmlSchemaSet schemas, System.Xml.Schema.XmlSchemaElement element);
member this.Import : System.Xml.Schema.XmlSchemaSet * System.Xml.Schema.XmlSchemaElement -> System.Xml.XmlQualifiedName
Public Function Import (schemas As XmlSchemaSet, element As XmlSchemaElement) As XmlQualifiedName

Parámetros

schemas
XmlSchemaSet

Un XmlSchemaSet que contiene los esquemas para transformar.

element
XmlSchemaElement

Un XmlSchemaElement que representa el elemento de esquema específico para transformar.

Devoluciones

Una XmlQualifiedName que representa el elemento especificado.

Excepciones

El parámetro schemas o element es null.

Se aplica a

Import(XmlSchemaSet, XmlQualifiedName)

Transforma el tipo de esquema XML especificado incluido en XmlSchemaSet en CodeCompileUnit.

public:
 void Import(System::Xml::Schema::XmlSchemaSet ^ schemas, System::Xml::XmlQualifiedName ^ typeName);
public void Import (System.Xml.Schema.XmlSchemaSet schemas, System.Xml.XmlQualifiedName typeName);
member this.Import : System.Xml.Schema.XmlSchemaSet * System.Xml.XmlQualifiedName -> unit
Public Sub Import (schemas As XmlSchemaSet, typeName As XmlQualifiedName)

Parámetros

schemas
XmlSchemaSet

Un XmlSchemaSet que contiene las representaciones del esquema.

typeName
XmlQualifiedName

Un XmlQualifiedName que representa un tipo de esquema específico para importar.

Excepciones

El parámetro schemas o typeName es null.

Se aplica a