XsdDataContractImporter.CanImport 메서드

정의

스키마를 CodeCompileUnit으로 변환할 수 있는지 여부를 나타내는 값을 가져옵니다.

오버로드

CanImport(XmlSchemaSet)

XmlSchemaSet에 포함된 스키마를 CodeCompileUnit로 변환할 수 있는지 여부를 나타내는 값을 가져옵니다.

CanImport(XmlSchemaSet, ICollection<XmlQualifiedName>)

XmlSchemaSet에서 지정한 형식 집합을 CodeCompileUnit로 생성된 CLR 형식으로 변환할 수 있는지 여부를 나타내는 값을 가져옵니다.

CanImport(XmlSchemaSet, XmlSchemaElement)

XmlSchemaSet에서 특정 스키마 요소를 가져올 수 있는지 여부를 나타내는 값을 가져옵니다.

CanImport(XmlSchemaSet, XmlQualifiedName)

XmlSchemaSet에 포함된 스키마를 CodeCompileUnit로 변환할 수 있는지 여부를 나타내는 값을 가져옵니다.

설명

가져올 수 있는 형식에 대 한 자세한 내용은 참조 하세요. Types Supported by the Data Contract Serializer합니다.

CanImport(XmlSchemaSet)

XmlSchemaSet에 포함된 스키마를 CodeCompileUnit로 변환할 수 있는지 여부를 나타내는 값을 가져옵니다.

public:
 bool CanImport(System::Xml::Schema::XmlSchemaSet ^ schemas);
public bool CanImport (System.Xml.Schema.XmlSchemaSet schemas);
member this.CanImport : System.Xml.Schema.XmlSchemaSet -> bool
Public Function CanImport (schemas As XmlSchemaSet) As Boolean

매개 변수

schemas
XmlSchemaSet

변환할 스키마를 포함하는 XmlSchemaSet입니다.

반환

Boolean

스키마를 데이터 계약 형식으로 변환할 수 있으면 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>)

XmlSchemaSet에서 지정한 형식 집합을 CodeCompileUnit로 생성된 CLR 형식으로 변환할 수 있는지 여부를 나타내는 값을 가져옵니다.

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);
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

변환할 스키마를 포함하는 XmlSchemaSet입니다.

typeNames
ICollection<XmlQualifiedName>

가져올 스키마 형식 집합을 나타내는 ICollection<T>XmlQualifiedName입니다.

반환

Boolean

스키마를 변환할 수 있으면 true이고, 그렇지 않으면 false입니다.

예외

schemas 또는 typeNames 매개 변수가 null인 경우

가져오기와 관련된 데이터 계약이 잘못된 경우

적용 대상

CanImport(XmlSchemaSet, XmlSchemaElement)

XmlSchemaSet에서 특정 스키마 요소를 가져올 수 있는지 여부를 나타내는 값을 가져옵니다.

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);
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입니다.

반환

Boolean

요소를 가져올 수 있으면 true이고, 그렇지 않으면 false입니다.

예외

schemas 또는 element 매개 변수가 null인 경우

가져오기와 관련된 데이터 계약이 잘못된 경우

설명

이 메서드는 형식과 이 형식에서 참조한 모든 스키마 형식을 확인합니다.

적용 대상

CanImport(XmlSchemaSet, XmlQualifiedName)

XmlSchemaSet에 포함된 스키마를 CodeCompileUnit로 변환할 수 있는지 여부를 나타내는 값을 가져옵니다.

public:
 bool CanImport(System::Xml::Schema::XmlSchemaSet ^ schemas, System::Xml::XmlQualifiedName ^ typeName);
public bool CanImport (System.Xml.Schema.XmlSchemaSet schemas, System.Xml.XmlQualifiedName typeName);
member this.CanImport : System.Xml.Schema.XmlSchemaSet * System.Xml.XmlQualifiedName -> bool
Public Function CanImport (schemas As XmlSchemaSet, typeName As XmlQualifiedName) As Boolean

매개 변수

schemas
XmlSchemaSet

스키마 표현을 포함하는 XmlSchemaSet입니다.

typeName
XmlQualifiedName

IList에서 가져와야 할 스키마 형식의 이름을 지정하는 XmlQualifiedNameXmlSchemaSet입니다.

반환

Boolean

스키마를 데이터 계약 형식으로 변환할 수 있으면 true이고, 그렇지 않으면 false입니다.

예외

schemas 또는 typeName 매개 변수가 null인 경우

가져오기와 관련된 데이터 계약이 잘못된 경우

설명

가져올 수 있는 형식에 대 한 자세한 내용은 참조 하세요. Types Supported by the Data Contract Serializer합니다.

적용 대상