XsdDataContractImporter.Import メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
一連の XML スキーマを、CLR コードの生成に使用される CodeCompileUnit に変換します。
オーバーロード
| 名前 | 説明 |
|---|---|
| Import(XmlSchemaSet) |
XmlSchemaSetに含まれる指定された XML スキーマのセットをCodeCompileUnitに変換します。 |
| Import(XmlSchemaSet, ICollection<XmlQualifiedName>) |
XmlSchemaSetに含まれる指定したスキーマ型のセットを、CodeCompileUnitに生成された CLR 型に変換します。 |
| Import(XmlSchemaSet, XmlSchemaElement) |
指定した XML スキーマのセット内の指定したスキーマ要素を CodeCompileUnit に変換し、指定した要素のデータ コントラクト名を表す XmlQualifiedName を返します。 |
| Import(XmlSchemaSet, XmlQualifiedName) |
XmlSchemaSetに含まれる指定した XML スキーマ型をCodeCompileUnitに変換します。 |
Import(XmlSchemaSet)
XmlSchemaSetに含まれる指定された XML スキーマのセットを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)
パラメーター
- schemas
- XmlSchemaSet
CLR 型を生成するスキーマ表現を含む XmlSchemaSet 。
- 属性
例外
schemas パラメーターはnull。
例
次の例では、 CanImport メソッドを使用して、スキーマのセットをインポートできるかどうかをテストします。
CanImport メソッドがtrueを返す場合、コードは 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
適用対象
Import(XmlSchemaSet, ICollection<XmlQualifiedName>)
XmlSchemaSetに含まれる指定したスキーマ型のセットを、CodeCompileUnitに生成された CLR 型に変換します。
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))
パラメーター
- schemas
- XmlSchemaSet
スキーマ表現を含む XmlSchemaSet 。
- typeNames
- ICollection<XmlQualifiedName>
インポートするスキーマ型のセット。
- 属性
適用対象
Import(XmlSchemaSet, XmlSchemaElement)
指定した XML スキーマのセット内の指定したスキーマ要素を CodeCompileUnit に変換し、指定した要素のデータ コントラクト名を表す XmlQualifiedName を返します。
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
パラメーター
- schemas
- XmlSchemaSet
変換するスキーマを含む XmlSchemaSet 。
- element
- XmlSchemaElement
変換する特定のスキーマ要素を表す XmlSchemaElement 。
返品
指定した要素を表す XmlQualifiedName 。
- 属性
例外
schemasまたはelementパラメーターがnull。
適用対象
Import(XmlSchemaSet, XmlQualifiedName)
XmlSchemaSetに含まれる指定した XML スキーマ型を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)
パラメーター
- schemas
- XmlSchemaSet
スキーマ表現を含む XmlSchemaSet 。
- typeName
- XmlQualifiedName
インポートする特定のスキーマ型を表す XmlQualifiedName 。
- 属性
例外
schemasまたはtypeNameパラメーターがnull。