XsdDataContractImporter.CanImport Metodo

Definizione

Ottiene un valore che indica se gli schemi possono essere trasformati in un oggetto CodeCompileUnit.

Overload

Nome Descrizione
CanImport(XmlSchemaSet)

Ottiene un valore che indica se gli schemi contenuti in un XmlSchemaSet oggetto possono essere trasformati in un oggetto CodeCompileUnit.

CanImport(XmlSchemaSet, ICollection<XmlQualifiedName>)

Ottiene un valore che indica se il set specificato di tipi contenuti in un XmlSchemaSet oggetto può essere trasformato in tipi CLR generati in un oggetto CodeCompileUnit.

CanImport(XmlSchemaSet, XmlSchemaElement)

Ottiene un valore che indica se è possibile importare un elemento dello schema specifico contenuto in un XmlSchemaSet oggetto .

CanImport(XmlSchemaSet, XmlQualifiedName)

Ottiene un valore che indica se gli schemi contenuti in un XmlSchemaSet oggetto possono essere trasformati in un oggetto CodeCompileUnit.

Commenti

Per altre informazioni sui tipi che è possibile importare, vedere Tipi supportati dal serializzatore di contratti dati.

CanImport(XmlSchemaSet)

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

Ottiene un valore che indica se gli schemi contenuti in un XmlSchemaSet oggetto possono essere trasformati in un oggetto CodeCompileUnit.

public:
 bool CanImport(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 bool CanImport(System.Xml.Schema.XmlSchemaSet schemas);
public bool CanImport(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.CanImport : System.Xml.Schema.XmlSchemaSet -> bool
member this.CanImport : System.Xml.Schema.XmlSchemaSet -> bool
Public Function CanImport (schemas As XmlSchemaSet) As Boolean

Parametri

schemas
XmlSchemaSet

Oggetto XmlSchemaSet contenente gli schemi da trasformare.

Valori restituiti

true se gli schemi possono essere trasformati in tipi di contratto dati; in caso contrario, false.

Attributi

Eccezioni

Il schemas parametro è null.

Un contratto dati coinvolto nell'importazione non è valido.

Esempio

Nell'esempio seguente viene chiamato il CanImport metodo per determinare se è possibile generare .CodeCompileUnit

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

CanImport(XmlSchemaSet, ICollection<XmlQualifiedName>)

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

Ottiene un valore che indica se il set specificato di tipi contenuti in un XmlSchemaSet oggetto può essere trasformato in tipi CLR generati in un oggetto CodeCompileUnit.

public:
 bool CanImport(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 bool CanImport(System.Xml.Schema.XmlSchemaSet schemas, System.Collections.Generic.ICollection<System.Xml.XmlQualifiedName> typeNames);
public bool CanImport(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.CanImport : System.Xml.Schema.XmlSchemaSet * System.Collections.Generic.ICollection<System.Xml.XmlQualifiedName> -> bool
member this.CanImport : System.Xml.Schema.XmlSchemaSet * System.Collections.Generic.ICollection<System.Xml.XmlQualifiedName> -> bool
Public Function CanImport (schemas As XmlSchemaSet, typeNames As ICollection(Of XmlQualifiedName)) As Boolean

Parametri

schemas
XmlSchemaSet

Schemi da trasformare.

typeNames
ICollection<XmlQualifiedName>

Set di tipi di schema da importare.

Valori restituiti

true se gli schemi possono essere trasformati; in caso contrario, false.

Attributi

Eccezioni

Il schemas parametro o typeNames è null.

Un contratto dati coinvolto nell'importazione non è valido.

Si applica a

CanImport(XmlSchemaSet, XmlSchemaElement)

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

Ottiene un valore che indica se è possibile importare un elemento dello schema specifico contenuto in un XmlSchemaSet oggetto .

public:
 bool CanImport(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 bool CanImport(System.Xml.Schema.XmlSchemaSet schemas, System.Xml.Schema.XmlSchemaElement element);
public bool CanImport(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.CanImport : System.Xml.Schema.XmlSchemaSet * System.Xml.Schema.XmlSchemaElement -> bool
member this.CanImport : System.Xml.Schema.XmlSchemaSet * System.Xml.Schema.XmlSchemaElement -> bool
Public Function CanImport (schemas As XmlSchemaSet, element As XmlSchemaElement) As Boolean

Parametri

schemas
XmlSchemaSet

Oggetto XmlSchemaSet da importare.

element
XmlSchemaElement

Oggetto specifico XmlSchemaElement per archiviare il set di schemi.

Valori restituiti

true se l'elemento può essere importato; in caso contrario, false.

Attributi

Eccezioni

Il schemas parametro o element è null.

Un contratto dati coinvolto nell'importazione non è valido.

Commenti

Questo metodo controlla il tipo e tutti i tipi di schema a cui viene fatto riferimento.

Si applica a

CanImport(XmlSchemaSet, XmlQualifiedName)

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

Ottiene un valore che indica se gli schemi contenuti in un XmlSchemaSet oggetto possono essere trasformati in un oggetto CodeCompileUnit.

public:
 bool CanImport(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 bool CanImport(System.Xml.Schema.XmlSchemaSet schemas, System.Xml.XmlQualifiedName typeName);
public bool CanImport(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.CanImport : System.Xml.Schema.XmlSchemaSet * System.Xml.XmlQualifiedName -> bool
member this.CanImport : System.Xml.Schema.XmlSchemaSet * System.Xml.XmlQualifiedName -> bool
Public Function CanImport (schemas As XmlSchemaSet, typeName As XmlQualifiedName) As Boolean

Parametri

schemas
XmlSchemaSet

Rappresentazioni dello schema.

typeName
XmlQualifiedName

Nomi dei tipi di schema che devono essere importati da XmlSchemaSet.

Valori restituiti

true se gli schemi possono essere trasformati in tipi di contratto dati; in caso contrario, false.

Attributi

Eccezioni

Il schemas parametro o typeName è null.

Un contratto dati coinvolto nell'importazione non è valido.

Commenti

Per altre informazioni sui tipi che è possibile importare, vedere Tipi supportati dal serializzatore di contratti dati.

Si applica a