XsdDataContractImporter.Import Metod

Definition

Omvandlar en uppsättning XML-scheman till en CodeCompileUnit som används för att generera CLR-kod.

Överlagringar

Name Description
Import(XmlSchemaSet)

Omvandlar den angivna uppsättningen XML-scheman som finns i en XmlSchemaSet till en CodeCompileUnit.

Import(XmlSchemaSet, ICollection<XmlQualifiedName>)

Omvandlar den angivna uppsättningen schematyper som finns i en XmlSchemaSet till CLR-typer som genereras till en CodeCompileUnit.

Import(XmlSchemaSet, XmlSchemaElement)

Transformerar det angivna schemaelementet i uppsättningen med angivna XML-scheman till en CodeCompileUnit och returnerar ett XmlQualifiedName som representerar datakontraktets namn för det angivna elementet.

Import(XmlSchemaSet, XmlQualifiedName)

Omvandlar den angivna XML-schematypen i en XmlSchemaSet till en CodeCompileUnit.

Import(XmlSchemaSet)

Källa:
XsdDataContractImporter.cs
Källa:
XsdDataContractImporter.cs
Källa:
XsdDataContractImporter.cs
Källa:
XsdDataContractImporter.cs

Omvandlar den angivna uppsättningen XML-scheman som finns i en XmlSchemaSet till 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)

Parametrar

schemas
XmlSchemaSet

En XmlSchemaSet som innehåller de schemarepresentationer som ska generera CLR-typer för.

Attribut

Undantag

Parametern schemas är null.

Exempel

I följande exempel används CanImport metoden för att testa om en uppsättning scheman kan importeras. CanImport Om metoden returnerar trueanropar Import koden metoden.

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

Gäller för

Import(XmlSchemaSet, ICollection<XmlQualifiedName>)

Källa:
XsdDataContractImporter.cs
Källa:
XsdDataContractImporter.cs
Källa:
XsdDataContractImporter.cs
Källa:
XsdDataContractImporter.cs

Omvandlar den angivna uppsättningen schematyper som finns i en XmlSchemaSet till CLR-typer som genereras till 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))

Parametrar

schemas
XmlSchemaSet

En XmlSchemaSet som innehåller schemarepresentationerna.

typeNames
ICollection<XmlQualifiedName>

Den uppsättning schematyper som ska importeras.

Attribut

Gäller för

Import(XmlSchemaSet, XmlSchemaElement)

Källa:
XsdDataContractImporter.cs
Källa:
XsdDataContractImporter.cs
Källa:
XsdDataContractImporter.cs
Källa:
XsdDataContractImporter.cs

Transformerar det angivna schemaelementet i uppsättningen med angivna XML-scheman till en CodeCompileUnit och returnerar ett XmlQualifiedName som representerar datakontraktets namn för det angivna elementet.

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

Parametrar

schemas
XmlSchemaSet

En XmlSchemaSet som innehåller de scheman som ska transformeras.

element
XmlSchemaElement

Ett XmlSchemaElement som representerar det specifika schemaelement som ska transformeras.

Returer

En XmlQualifiedName som representerar det angivna elementet.

Attribut

Undantag

Parametern schemas eller element är null.

Gäller för

Import(XmlSchemaSet, XmlQualifiedName)

Källa:
XsdDataContractImporter.cs
Källa:
XsdDataContractImporter.cs
Källa:
XsdDataContractImporter.cs
Källa:
XsdDataContractImporter.cs

Omvandlar den angivna XML-schematypen i en XmlSchemaSet till en 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)

Parametrar

schemas
XmlSchemaSet

En XmlSchemaSet som innehåller schemarepresentationerna.

typeName
XmlQualifiedName

En XmlQualifiedName som representerar en specifik schematyp som ska importeras.

Attribut

Undantag

Parametern schemas eller typeName är null.

Gäller för