XsdDataContractImporter.Import Metodo

Definizione

Trasforma un set di XML Schema in un CodeCompileUnit oggetto utilizzato per generare codice CLR.

Overload

Nome Descrizione
Import(XmlSchemaSet)

Trasforma il set specificato di XML Schema contenuti in un XmlSchemaSet oggetto CodeCompileUnit.

Import(XmlSchemaSet, ICollection<XmlQualifiedName>)

Trasforma il set specificato di tipi di schema contenuti in un XmlSchemaSet oggetto in tipi CLR generati in un oggetto CodeCompileUnit.

Import(XmlSchemaSet, XmlSchemaElement)

Trasforma l'elemento dello schema specificato nel set di XML Schema specificati in un CodeCompileUnit oggetto e restituisce un oggetto XmlQualifiedName che rappresenta il nome del contratto dati per l'elemento specificato.

Import(XmlSchemaSet, XmlQualifiedName)

Trasforma il tipo di XML Schema specificato contenuto in un XmlSchemaSet oggetto CodeCompileUnit.

Import(XmlSchemaSet)

Origine:
XsdDataContractImporter.cs
Origine:
XsdDataContractImporter.cs
Origine:
XsdDataContractImporter.cs
Origine:
XsdDataContractImporter.cs

Trasforma il set specificato di XML Schema contenuti in un XmlSchemaSet oggetto 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)

Parametri

schemas
XmlSchemaSet

Oggetto XmlSchemaSet contenente le rappresentazioni dello schema per cui generare tipi CLR.

Attributi

Eccezioni

Il schemas parametro è null.

Esempio

Nell'esempio seguente viene utilizzato il CanImport metodo per verificare se è possibile importare un set di schemi. Se il CanImport metodo restituisce true, il codice richiama il Import metodo .

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

Si applica a

Import(XmlSchemaSet, ICollection<XmlQualifiedName>)

Origine:
XsdDataContractImporter.cs
Origine:
XsdDataContractImporter.cs
Origine:
XsdDataContractImporter.cs
Origine:
XsdDataContractImporter.cs

Trasforma il set specificato di tipi di schema contenuti in un XmlSchemaSet oggetto in tipi CLR generati in un oggetto 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))

Parametri

schemas
XmlSchemaSet

Oggetto XmlSchemaSet contenente le rappresentazioni dello schema.

typeNames
ICollection<XmlQualifiedName>

Set di tipi di schema da importare.

Attributi

Si applica a

Import(XmlSchemaSet, XmlSchemaElement)

Origine:
XsdDataContractImporter.cs
Origine:
XsdDataContractImporter.cs
Origine:
XsdDataContractImporter.cs
Origine:
XsdDataContractImporter.cs

Trasforma l'elemento dello schema specificato nel set di XML Schema specificati in un CodeCompileUnit oggetto e restituisce un oggetto XmlQualifiedName che rappresenta il nome del contratto dati per l'elemento specificato.

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

Parametri

schemas
XmlSchemaSet

Oggetto XmlSchemaSet contenente gli schemi da trasformare.

element
XmlSchemaElement

Oggetto XmlSchemaElement che rappresenta l'elemento dello schema specifico da trasformare.

Valori restituiti

Oggetto XmlQualifiedName che rappresenta l'elemento specificato.

Attributi

Eccezioni

Il schemas parametro o element è null.

Si applica a

Import(XmlSchemaSet, XmlQualifiedName)

Origine:
XsdDataContractImporter.cs
Origine:
XsdDataContractImporter.cs
Origine:
XsdDataContractImporter.cs
Origine:
XsdDataContractImporter.cs

Trasforma il tipo di XML Schema specificato contenuto in un XmlSchemaSet oggetto 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)

Parametri

schemas
XmlSchemaSet

Oggetto XmlSchemaSet contenente le rappresentazioni dello schema.

typeName
XmlQualifiedName

Oggetto XmlQualifiedName che rappresenta un tipo di schema specifico da importare.

Attributi

Eccezioni

Il schemas parametro o typeName è null.

Si applica a