Share via


XsdDataContractImporter.Import Método

Definição

Transforma um conjunto de esquemas XML em um CodeCompileUnit usado para gerar o código CLR.

Sobrecargas

Import(XmlSchemaSet)

Transforma o conjunto especificado de esquemas XML contidos em um XmlSchemaSet em um CodeCompileUnit.

Import(XmlSchemaSet, ICollection<XmlQualifiedName>)

Transforma o conjunto especificado de tipos de esquema contido em um XmlSchemaSet em tipos CLR gerados em um CodeCompileUnit.

Import(XmlSchemaSet, XmlSchemaElement)

Transforma o elemento de esquema especificado no conjunto de esquemas XML fornecido em um CodeCompileUnit e retorna um XmlQualifiedName que representa o nome de contrato de dados para o elemento indicado.

Import(XmlSchemaSet, XmlQualifiedName)

Transforma o tipo de esquema XML especificado contido em um XmlSchemaSet em um CodeCompileUnit.

Import(XmlSchemaSet)

Origem:
XsdDataContractImporter.cs
Origem:
XsdDataContractImporter.cs

Transforma o conjunto especificado de esquemas XML contidos em um XmlSchemaSet em um 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

Um XmlSchemaSet que contém as representações de esquema para as quais os tipos CLR serão gerados.

Exceções

O parâmetro schemas é null.

Exemplos

O exemplo a seguir usa o CanImport método para testar se um conjunto de esquemas pode ser importado. Se o CanImport método retornar true, o código invocará o 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

Aplica-se a

Import(XmlSchemaSet, ICollection<XmlQualifiedName>)

Origem:
XsdDataContractImporter.cs
Origem:
XsdDataContractImporter.cs

Transforma o conjunto especificado de tipos de esquema contido em um XmlSchemaSet em tipos CLR gerados em um 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

Um XmlSchemaSet que contém as representações de esquema.

typeNames
ICollection<XmlQualifiedName>

Um ICollection<T> (de XmlQualifiedName) que representa o conjunto de tipos de esquema para importação.

Aplica-se a

Import(XmlSchemaSet, XmlSchemaElement)

Origem:
XsdDataContractImporter.cs
Origem:
XsdDataContractImporter.cs

Transforma o elemento de esquema especificado no conjunto de esquemas XML fornecido em um CodeCompileUnit e retorna um XmlQualifiedName que representa o nome de contrato de dados para o elemento indicado.

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

Um XmlSchemaSet que contém os esquemas a serem transformados.

element
XmlSchemaElement

Um XmlSchemaElement que representa o elemento de esquema específico a ser transformado.

Retornos

Um XmlQualifiedName que representa o elemento especificado.

Exceções

O parâmetro schemas ou element é null.

Aplica-se a

Import(XmlSchemaSet, XmlQualifiedName)

Origem:
XsdDataContractImporter.cs
Origem:
XsdDataContractImporter.cs

Transforma o tipo de esquema XML especificado contido em um XmlSchemaSet em um 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

Um XmlSchemaSet que contém as representações de esquema.

typeName
XmlQualifiedName

Um XmlQualifiedName que representa um tipo de esquema específico para importação.

Exceções

O parâmetro schemas ou typeName é null.

Aplica-se a