XsdDataContractImporter.Import Método

Definición

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

Sobrecargas

Nombre Description
Import(XmlSchemaSet)

Transforma el conjunto especificado de esquemas XML contenidos en un XmlSchemaSet objeto en .CodeCompileUnit

Import(XmlSchemaSet, ICollection<XmlQualifiedName>)

Transforma el conjunto especificado de tipos de esquema contenidos en tipos XmlSchemaSet CLR generados en .CodeCompileUnit

Import(XmlSchemaSet, XmlSchemaElement)

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

Import(XmlSchemaSet, XmlQualifiedName)

Transforma el tipo de esquema XML especificado incluido en en XmlSchemaSet un CodeCompileUnitobjeto .

Import(XmlSchemaSet)

Source:
XsdDataContractImporter.cs
Source:
XsdDataContractImporter.cs
Source:
XsdDataContractImporter.cs
Source:
XsdDataContractImporter.cs

Transforma el conjunto especificado de esquemas XML contenidos en un XmlSchemaSet objeto en .CodeCompileUnit

public:
 void Import(System::Xml::Schema::XmlSchemaSet ^ schemas);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public void Import(System.Xml.Schema.XmlSchemaSet schemas);
public void Import(System.Xml.Schema.XmlSchemaSet schemas);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
member this.Import : System.Xml.Schema.XmlSchemaSet -> unit
member this.Import : System.Xml.Schema.XmlSchemaSet -> unit
Public Sub Import (schemas As XmlSchemaSet)

Parámetros

schemas
XmlSchemaSet

que XmlSchemaSet contiene las representaciones de esquema para las que se van a generar tipos CLR.

Atributos

Excepciones

El schemas parámetro es null.

Ejemplos

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

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>)

Source:
XsdDataContractImporter.cs
Source:
XsdDataContractImporter.cs
Source:
XsdDataContractImporter.cs
Source:
XsdDataContractImporter.cs

Transforma el conjunto especificado de tipos de esquema contenidos en tipos XmlSchemaSet CLR generados en .CodeCompileUnit

public:
 void Import(System::Xml::Schema::XmlSchemaSet ^ schemas, System::Collections::Generic::ICollection<System::Xml::XmlQualifiedName ^> ^ typeNames);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
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);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
member this.Import : System.Xml.Schema.XmlSchemaSet * System.Collections.Generic.ICollection<System.Xml.XmlQualifiedName> -> unit
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

que XmlSchemaSet contiene las representaciones de esquema.

typeNames
ICollection<XmlQualifiedName>

Conjunto de tipos de esquema que se van a importar.

Atributos

Se aplica a

Import(XmlSchemaSet, XmlSchemaElement)

Source:
XsdDataContractImporter.cs
Source:
XsdDataContractImporter.cs
Source:
XsdDataContractImporter.cs
Source:
XsdDataContractImporter.cs

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

public:
 System::Xml::XmlQualifiedName ^ Import(System::Xml::Schema::XmlSchemaSet ^ schemas, System::Xml::Schema::XmlSchemaElement ^ element);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
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);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
member this.Import : System.Xml.Schema.XmlSchemaSet * System.Xml.Schema.XmlSchemaElement -> System.Xml.XmlQualifiedName
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

que XmlSchemaSet contiene los esquemas que se van a transformar.

element
XmlSchemaElement

que XmlSchemaElement representa el elemento de esquema específico que se va a transformar.

Devoluciones

que XmlQualifiedName representa el elemento especificado.

Atributos

Excepciones

El parámetro schemas o element es null.

Se aplica a

Import(XmlSchemaSet, XmlQualifiedName)

Source:
XsdDataContractImporter.cs
Source:
XsdDataContractImporter.cs
Source:
XsdDataContractImporter.cs
Source:
XsdDataContractImporter.cs

Transforma el tipo de esquema XML especificado incluido en en XmlSchemaSet un CodeCompileUnitobjeto .

public:
 void Import(System::Xml::Schema::XmlSchemaSet ^ schemas, System::Xml::XmlQualifiedName ^ typeName);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public void Import(System.Xml.Schema.XmlSchemaSet schemas, System.Xml.XmlQualifiedName typeName);
public void Import(System.Xml.Schema.XmlSchemaSet schemas, System.Xml.XmlQualifiedName typeName);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
member this.Import : System.Xml.Schema.XmlSchemaSet * System.Xml.XmlQualifiedName -> unit
member this.Import : System.Xml.Schema.XmlSchemaSet * System.Xml.XmlQualifiedName -> unit
Public Sub Import (schemas As XmlSchemaSet, typeName As XmlQualifiedName)

Parámetros

schemas
XmlSchemaSet

que XmlSchemaSet contiene las representaciones de esquema.

typeName
XmlQualifiedName

XmlQualifiedName que representa un tipo de esquema específico que se va a importar.

Atributos

Excepciones

El parámetro schemas o typeName es null.

Se aplica a