Język

XsdDataContractImporter.Import Metoda

Definicja

Przekształca zestaw schematów XML w CodeCompileUnit kod używany do generowania kodu CLR.

Przeciążenia

Nazwa Opis
Import(XmlSchemaSet)

Przekształca określony zestaw schematów XML zawartych w elemecie XmlSchemaSetCodeCompileUnit.

Import(XmlSchemaSet, ICollection<XmlQualifiedName>)

Przekształca określony zestaw typów schematów zawartych w XmlSchemaSet typach CLR wygenerowanych na CodeCompileUnit.

Import(XmlSchemaSet, XmlSchemaElement)

Przekształca określony element schematu w zestawie określonych schematów XML na CodeCompileUnit element i zwraca wartość reprezentującą XmlQualifiedName nazwę kontraktu danych dla określonego elementu.

Import(XmlSchemaSet, XmlQualifiedName)

Przekształca określony typ schematu XML zawartego w obiekcie XmlSchemaSet w obiekcie CodeCompileUnit.

Import(XmlSchemaSet)

Źródło:
XsdDataContractImporter.cs
Źródło:
XsdDataContractImporter.cs
Źródło:
XsdDataContractImporter.cs
Źródło:
XsdDataContractImporter.cs

Przekształca określony zestaw schematów XML zawartych w elemecie XmlSchemaSetCodeCompileUnit.

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)

Parametry

schemas
XmlSchemaSet

Element XmlSchemaSet zawierający reprezentacje schematu służące do generowania typów CLR.

Atrybuty

Wyjątki

Parametr schemas jest null.

Przykłady

W poniższym przykładzie użyto CanImport metody do sprawdzenia, czy można zaimportować zestaw schematów. CanImport Jeśli metoda zwróci truemetodę , kod wywołuje metodę Import .

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

Dotyczy

Import(XmlSchemaSet, ICollection<XmlQualifiedName>)

Źródło:
XsdDataContractImporter.cs
Źródło:
XsdDataContractImporter.cs
Źródło:
XsdDataContractImporter.cs
Źródło:
XsdDataContractImporter.cs

Przekształca określony zestaw typów schematów zawartych w XmlSchemaSet typach CLR wygenerowanych na 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))

Parametry

schemas
XmlSchemaSet

Element XmlSchemaSet zawierający reprezentacje schematu.

typeNames
ICollection<XmlQualifiedName>

Zestaw typów schematów do zaimportowania.

Atrybuty

Dotyczy

Import(XmlSchemaSet, XmlSchemaElement)

Źródło:
XsdDataContractImporter.cs
Źródło:
XsdDataContractImporter.cs
Źródło:
XsdDataContractImporter.cs
Źródło:
XsdDataContractImporter.cs

Przekształca określony element schematu w zestawie określonych schematów XML na CodeCompileUnit element i zwraca wartość reprezentującą XmlQualifiedName nazwę kontraktu danych dla określonego elementu.

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

Parametry

schemas
XmlSchemaSet

Element XmlSchemaSet zawierający schematy do przekształcenia.

element
XmlSchemaElement

Element XmlSchemaElement reprezentujący określony element schematu do przekształcenia.

Zwraca

Element XmlQualifiedName reprezentujący określony element.

Atrybuty

Wyjątki

Parametr schemas or element to null.

Dotyczy

Import(XmlSchemaSet, XmlQualifiedName)

Źródło:
XsdDataContractImporter.cs
Źródło:
XsdDataContractImporter.cs
Źródło:
XsdDataContractImporter.cs
Źródło:
XsdDataContractImporter.cs

Przekształca określony typ schematu XML zawartego w obiekcie XmlSchemaSet w obiekcie 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)

Parametry

schemas
XmlSchemaSet

Element XmlSchemaSet zawierający reprezentacje schematu.

typeName
XmlQualifiedName

Element XmlQualifiedName reprezentujący określony typ schematu do zaimportowania.

Atrybuty

Wyjątki

Parametr schemas or typeName to null.

Dotyczy