XsdDataContractImporter.Import Methode

Definition

Wandelt eine Reihe von XML-Schemas in einen CodeCompileUnit verwendeten CLR-Code um.

Überlädt

Name Beschreibung
Import(XmlSchemaSet)

Transformiert den angegebenen Satz von XML-Schemas in einer XmlSchemaSet in eine CodeCompileUnit.

Import(XmlSchemaSet, ICollection<XmlQualifiedName>)

Transformiert den angegebenen Satz von Schematypen, die in einem in einer XmlSchemaSet CLR-Typen enthalten sind, die in einem CodeCompileUnit.

Import(XmlSchemaSet, XmlSchemaElement)

Transformiert das angegebene Schemaelement in der Gruppe der angegebenen XML-Schemas in eine CodeCompileUnit und gibt einen XmlQualifiedName , der den Datenvertragsnamen für das angegebene Element darstellt.

Import(XmlSchemaSet, XmlQualifiedName)

Transformiert den angegebenen XML-Schematyp in einem XmlSchemaSet in eine CodeCompileUnit.

Import(XmlSchemaSet)

Quelle:
XsdDataContractImporter.cs
Quelle:
XsdDataContractImporter.cs
Quelle:
XsdDataContractImporter.cs
Quelle:
XsdDataContractImporter.cs

Transformiert den angegebenen Satz von XML-Schemas in einer XmlSchemaSet in eine 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)

Parameter

schemas
XmlSchemaSet

A XmlSchemaSet that contains the schema representations to generate CLR types for.

Attribute

Ausnahmen

Der schemas Parameter ist null.

Beispiele

Im folgenden Beispiel wird die CanImport Methode verwendet, um zu testen, ob eine Gruppe von Schemas importiert werden kann. Wenn die CanImport Methode zurückgegeben wird true, ruft der Code die Import Methode auf.

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

Gilt für:

Import(XmlSchemaSet, ICollection<XmlQualifiedName>)

Quelle:
XsdDataContractImporter.cs
Quelle:
XsdDataContractImporter.cs
Quelle:
XsdDataContractImporter.cs
Quelle:
XsdDataContractImporter.cs

Transformiert den angegebenen Satz von Schematypen, die in einem in einer XmlSchemaSet CLR-Typen enthalten sind, die in einem 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))

Parameter

schemas
XmlSchemaSet

Eine XmlSchemaSet , die die Schemadarstellungen enthält.

typeNames
ICollection<XmlQualifiedName>

Die Gruppe der zu importierenden Schematypen.

Attribute

Gilt für:

Import(XmlSchemaSet, XmlSchemaElement)

Quelle:
XsdDataContractImporter.cs
Quelle:
XsdDataContractImporter.cs
Quelle:
XsdDataContractImporter.cs
Quelle:
XsdDataContractImporter.cs

Transformiert das angegebene Schemaelement in der Gruppe der angegebenen XML-Schemas in eine CodeCompileUnit und gibt einen XmlQualifiedName , der den Datenvertragsnamen für das angegebene Element darstellt.

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

Parameter

schemas
XmlSchemaSet

Eine XmlSchemaSet , die die zu transformierenden Schemas enthält.

element
XmlSchemaElement

Ein XmlSchemaElement Element, das das zu transformierenden Schemaelement darstellt.

Gibt zurück

Ein XmlQualifiedName Element, das das angegebene Element darstellt.

Attribute

Ausnahmen

Der schemas Parameter ist elementnull.

Gilt für:

Import(XmlSchemaSet, XmlQualifiedName)

Quelle:
XsdDataContractImporter.cs
Quelle:
XsdDataContractImporter.cs
Quelle:
XsdDataContractImporter.cs
Quelle:
XsdDataContractImporter.cs

Transformiert den angegebenen XML-Schematyp in einem XmlSchemaSet in eine 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)

Parameter

schemas
XmlSchemaSet

Eine XmlSchemaSet , die die Schemadarstellungen enthält.

typeName
XmlQualifiedName

A XmlQualifiedName that represents a specific schema type to import.

Attribute

Ausnahmen

Der schemas Parameter ist typeNamenull.

Gilt für: