XsdDataContractImporter.CanImport メソッド

定義

スキーマを CodeCompileUnitに変換できるかどうかを示す値を取得します。

オーバーロード

名前 説明
CanImport(XmlSchemaSet)

XmlSchemaSetに含まれるスキーマをCodeCompileUnitに変換できるかどうかを示す値を取得します。

CanImport(XmlSchemaSet, ICollection<XmlQualifiedName>)

XmlSchemaSetに含まれる指定した型のセットを、CodeCompileUnitに生成された CLR 型に変換できるかどうかを示す値を取得します。

CanImport(XmlSchemaSet, XmlSchemaElement)

XmlSchemaSetに含まれる特定のスキーマ要素をインポートできるかどうかを示す値を取得します。

CanImport(XmlSchemaSet, XmlQualifiedName)

XmlSchemaSetに含まれるスキーマをCodeCompileUnitに変換できるかどうかを示す値を取得します。

注釈

インポートできる型の詳細については、「 データ コントラクト シリアライザーでサポートされる型」を参照してください。

CanImport(XmlSchemaSet)

ソース:
XsdDataContractImporter.cs
ソース:
XsdDataContractImporter.cs
ソース:
XsdDataContractImporter.cs
ソース:
XsdDataContractImporter.cs

XmlSchemaSetに含まれるスキーマを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

パラメーター

schemas
XmlSchemaSet

変換するスキーマを含む XmlSchemaSet

返品

true スキーマをデータ コントラクト型に変換できる場合。それ以外の場合は false

属性

例外

schemas パラメーターはnull

インポートに関係するデータ コントラクトが無効です。

次の例では、 CanImport メソッドを呼び出して、 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

適用対象

CanImport(XmlSchemaSet, ICollection<XmlQualifiedName>)

ソース:
XsdDataContractImporter.cs
ソース:
XsdDataContractImporter.cs
ソース:
XsdDataContractImporter.cs
ソース:
XsdDataContractImporter.cs

XmlSchemaSetに含まれる指定した型のセットを、CodeCompileUnitに生成された CLR 型に変換できるかどうかを示す値を取得します。

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

パラメーター

schemas
XmlSchemaSet

変換するスキーマ。

typeNames
ICollection<XmlQualifiedName>

インポートするスキーマ型のセット。

返品

true スキーマを変換できる場合。それ以外の場合は false

属性

例外

schemasまたはtypeNamesパラメーターがnull

インポートに関係するデータ コントラクトが無効です。

適用対象

CanImport(XmlSchemaSet, XmlSchemaElement)

ソース:
XsdDataContractImporter.cs
ソース:
XsdDataContractImporter.cs
ソース:
XsdDataContractImporter.cs
ソース:
XsdDataContractImporter.cs

XmlSchemaSetに含まれる特定のスキーマ要素をインポートできるかどうかを示す値を取得します。

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

パラメーター

schemas
XmlSchemaSet

インポートする XmlSchemaSet

element
XmlSchemaElement

スキーマのセットをチェックインする特定の XmlSchemaElement

返品

true 要素をインポートできる場合。それ以外の場合は false

属性

例外

schemasまたはelementパラメーターがnull

インポートに関係するデータ コントラクトが無効です。

注釈

このメソッドは、型と、そこから参照されるすべてのスキーマ型をチェックします。

適用対象

CanImport(XmlSchemaSet, XmlQualifiedName)

ソース:
XsdDataContractImporter.cs
ソース:
XsdDataContractImporter.cs
ソース:
XsdDataContractImporter.cs
ソース:
XsdDataContractImporter.cs

XmlSchemaSetに含まれるスキーマを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

パラメーター

schemas
XmlSchemaSet

スキーマ表現。

typeName
XmlQualifiedName

XmlSchemaSetからインポートする必要があるスキーマ型の名前。

返品

true スキーマをデータ コントラクト型に変換できる場合。それ以外の場合は false

属性

例外

schemasまたはtypeNameパラメーターがnull

インポートに関係するデータ コントラクトが無効です。

注釈

インポートできる型の詳細については、「 データ コントラクト シリアライザーでサポートされる型」を参照してください。

適用対象