XsdDataContractImporter.Import Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Transforma um conjunto de esquemas XML num CodeCompileUnit usado para gerar código CLR.
Sobrecargas
| Name | Descrição |
|---|---|
| Import(XmlSchemaSet) |
Transforma o conjunto especificado de esquemas XML contidos num XmlSchemaSet num CodeCompileUnit. |
| Import(XmlSchemaSet, ICollection<XmlQualifiedName>) |
Transforma o conjunto especificado de tipos de esquema contidos em um XmlSchemaSet em tipos CLR gerados em um CodeCompileUnit. |
| Import(XmlSchemaSet, XmlSchemaElement) |
Transforma o elemento de esquema especificado no conjunto de esquemas XML especificados num CodeCompileUnit e devolve um XmlQualifiedName que representa o nome do contrato de dados para o elemento especificado. |
| Import(XmlSchemaSet, XmlQualifiedName) |
Transforma o tipo de esquema XML especificado contido num XmlSchemaSet em CodeCompileUnit. |
Import(XmlSchemaSet)
- Origem:
- XsdDataContractImporter.cs
- Origem:
- XsdDataContractImporter.cs
- Origem:
- XsdDataContractImporter.cs
- Origem:
- XsdDataContractImporter.cs
Transforma o conjunto especificado de esquemas XML contidos num XmlSchemaSet num 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
A XmlSchemaSet que contém as representações do esquema para gerar tipos CLR para.
- Atributos
Exceções
O schemas parâmetro é null.
Exemplos
O exemplo seguinte utiliza o CanImport método para testar se um conjunto de esquemas pode ser importado. Se o CanImport método devolver true, o código invoca 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
- Origem:
- XsdDataContractImporter.cs
- Origem:
- XsdDataContractImporter.cs
Transforma o conjunto especificado de tipos de esquema contidos 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);
[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
A XmlSchemaSet que contém as representações do esquema.
- typeNames
- ICollection<XmlQualifiedName>
O conjunto de tipos de esquema a importar.
- Atributos
Aplica-se a
Import(XmlSchemaSet, XmlSchemaElement)
- Origem:
- XsdDataContractImporter.cs
- Origem:
- XsdDataContractImporter.cs
- Origem:
- XsdDataContractImporter.cs
- Origem:
- XsdDataContractImporter.cs
Transforma o elemento de esquema especificado no conjunto de esquemas XML especificados num CodeCompileUnit e devolve um XmlQualifiedName que representa o nome do contrato de dados para o 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
Um XmlSchemaSet que contém os esquemas a transformar.
- element
- XmlSchemaElement
E XmlSchemaElement que representa o elemento específico do esquema a transformar.
Devoluções
E XmlQualifiedName que representa o elemento especificado.
- Atributos
Exceções
O schemas parâmetro ou element é null.
Aplica-se a
Import(XmlSchemaSet, XmlQualifiedName)
- Origem:
- XsdDataContractImporter.cs
- Origem:
- XsdDataContractImporter.cs
- Origem:
- XsdDataContractImporter.cs
- Origem:
- XsdDataContractImporter.cs
Transforma o tipo de esquema XML especificado contido num XmlSchemaSet em CodeCompileUnit.
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
A XmlSchemaSet que contém as representações do esquema.
- typeName
- XmlQualifiedName
A XmlQualifiedName que representa um tipo específico de esquema a importar.
- Atributos
Exceções
O schemas parâmetro ou typeName é null.