XsdDataContractImporter.CanImport 메서드

정의

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

오버로드

Name Description
CanImport(XmlSchemaSet)

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

CanImport(XmlSchemaSet, ICollection<XmlQualifiedName>)

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

CanImport(XmlSchemaSet, XmlSchemaElement)

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

CanImport(XmlSchemaSet, XmlQualifiedName)

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

설명

가져올 수 있는 형식에 대한 자세한 내용은 데이터 계약 직렬 변환기에서 지원하는 형식을 참조하세요.

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

변환할 스키마가 포함된 A 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>)

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

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

변환할 스키마입니다.

typeNames
ICollection<XmlQualifiedName>

가져올 스키마 형식 집합입니다.

반품

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 형식입니다.

반품

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

스키마 표현입니다.

typeName
XmlQualifiedName

에서 가져와야 하는 스키마 형식의 XmlSchemaSet이름입니다.

반품

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

예외

schemas 또는 typeName 매개 변수가 .입니다null.

가져오기와 관련된 데이터 계약이 잘못되었습니다.

설명

가져올 수 있는 형식에 대한 자세한 내용은 데이터 계약 직렬 변환기에서 지원하는 형식을 참조하세요.

적용 대상