ComplexType 클래스

정의

개념적 모델의 복합 형식을 나타냅니다.

public ref class ComplexType : System::Data::Metadata::Edm::StructuralType
public class ComplexType : System.Data.Metadata.Edm.StructuralType
type ComplexType = class
    inherit StructuralType
Public Class ComplexType
Inherits StructuralType
상속

예제

다음 코드 샘플은 연결에서 메타데이터 작업 영역을 가져오고 해당 메타데이터 작업 영역을 사용하여 지정된 모델에서 복합 형식의 속성에 대한 정보를 검색합니다. 메타데이터 작업 영역은 메타데이터 검색을 지원하는 런타임 서비스 구성 요소입니다.

코드 샘플에서는 CSpace를 사용하여 모델을 지정합니다. CSpace는 개념적 모델의 기본 이름을 나타냅니다. 코드 샘플에서는 방법: 복합 형식으로 모델 정의(Entity Framework) 항목에 제공된 CustomerComplexAddr 모델을 사용합니다.

using System;  
using System.Data;  
using System.Collections.ObjectModel;  
using System.Data.EntityClient;  
using System.Data.Metadata.Edm;  

class GetComplexTypeMembersExample  
{  
  static void Main()  
  {  
    try  
    {  
      // Establish a connection to the underlying data provider by   
      // using the connection string specified in the config file.  
      using (EntityConnection connection =  
        new EntityConnection("Name=CustomerWComplexAddrEntities"))  
      {  
         // Open the connection.  
         connection.Open();  

         // Access the metadata workspace.  
         MetadataWorkspace workspace =   
            connection.GetMetadataWorkspace();  

         // Get properties of complex types.  
         GetProperties(workspace, DataSpace.CSpace);  
      }  
    }  
    catch (MetadataException exceptionMetadata)  
    {  
       Console.WriteLine("MetadataException: {0}",  
              exceptionMetadata.Message);  
    }  
    catch (System.Data.MappingException exceptionMapping)  
    {  
       Console.WriteLine("MappingException: {0}",  
               exceptionMapping.Message);  
    }  
  }  

  public static void GetProperties(MetadataWorkspace workspace,   
      DataSpace model)  
  {  
    // Get a collection of complex types.  
    ReadOnlyCollection<ComplexType> complexTypes =  
       workspace.GetItems<ComplexType>(model);  

    // Iterate through the collection to get each complex type.  
    foreach (ComplexType complexType in complexTypes)  
    {  
       Console.WriteLine(  
         "\n\n***ComplexType Name: {0}, Namespace: {1}",  
         complexType.Name,  
         complexType.NamespaceName);  

       Console.WriteLine(  
          "\nGet the properties of this " +  
          "ComplexType object ==>");  
          // Iterate through the collection to get each property of the   
          // current ComplexType object.  
          foreach (EdmProperty property in complexType.Properties)  
          {  
            Console.Write("   Property Name: {0} ", property.Name);  

            Console.WriteLine(  
               "   Property declaring Type: {0}, edmtype: {1}," +  
               " default: {2}, nullable: {3} ",  
               property.DeclaringType, property.TypeUsage.EdmType,  
               property.Default, property.Nullable);  
          }  
      }  
  }  
}  
Imports System  
Imports System.Collections.ObjectModel  
Imports System.Data  
Imports System.Data.EntityClient  
Imports System.Data.Metadata.Edm  

Class GetComplexTypeMembersExample  
  Public Shared Sub Main()  
    Try  
      ' Establish a connection to the underlying data provider by   
      ' using the connection string specified in the config file.  
      Using connection As EntityConnection = _  
         New EntityConnection("Name=CustomerWComplexAddrEntities")  

         ' Open the connection.  
         connection.Open()  

         ' Access the metadata workspace.  
         Dim workspace As MetadataWorkspace = _  
            connection.GetMetadataWorkspace  

         ' Get properties of complex types.  
         GetProperties(workspace, DataSpace.CSpace)  
      End Using  
    Catch exceptionMetadata As MetadataException  
       Console.WriteLine("MetadataException: {0}", _  
           exceptionMetadata.Message)  
    Catch exceptionMapping As MappingException  
       Console.WriteLine("MappingException: {0}", _  
           exceptionMapping.Message)  
     End Try  
  End Sub  

  Public Shared Sub GetProperties( _  
    ByVal workspace As MetadataWorkspace, ByVal model As DataSpace)  

    ' Get a collection of complex types.  
    Dim complexTypes As ReadOnlyCollection(Of ComplexType) = _  
       workspace.GetItems(Of ComplexType)(model)  

    ' Iterate through the collection to get each complex type.  
    Dim complexType As ComplexType  
    For Each complexType In complexTypes  
       Console.WriteLine( _  
          ControlChars.Lf & ControlChars.Lf & _  
          "***ComplexType Name: {0}, Namespace: {1}", _  
          complexType.Name, complexType.NamespaceName)  

       Console.WriteLine(ControlChars.Lf & _  
          "Get the properties of this ComplexType object ==>")  

          ' Iterate through the collection to get each property of the   
          ' current ComplexType object.  
          Dim property1 As EdmProperty  
          For Each property1 In complexType.Properties  
            Console.Write("   Property Name: {0} ", property1.Name)  
            Console.WriteLine( _  
              "   Property declaring Type: {0}, edmtype: {1}, " + _  
              "default: {2}, nullable: {3} ", _  
              New Object() {property1.DeclaringType, _  
              property1.TypeUsage.EdmType, _  
              property1.Default, property1.Nullable})  
          Next  
        Next  
    End Sub  
End Class  

설명

개념적 모델의 은 ComplexType 엔터티 형식과 같은 속성 집합을 포함하지만 키 속성은 포함하지 않는 형식을 나타냅니다. 개념적 모델의 복합 형식에 대한 자세한 내용은 복합 형식방법: 복합 형식을 사용하여 모델 정의(Entity Framework)를 참조하세요.

속성

Abstract

이 형식이 추상 형식인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 EdmType)
BaseType

이 형식의 기본 형식을 가져옵니다.

(다음에서 상속됨 EdmType)
BuiltInTypeKind

ComplexType의 기본 제공 형식 유형을 가져옵니다.

Documentation

이 형식과 관련된 설명서를 가져오거나 설정합니다.

(다음에서 상속됨 MetadataItem)
FullName

이 형식의 전체 이름을 가져옵니다.

(다음에서 상속됨 EdmType)
Members

이 형식의 멤버 목록을 가져옵니다.

(다음에서 상속됨 StructuralType)
MetadataProperties

현재 형식의 속성 목록을 가져옵니다.

(다음에서 상속됨 MetadataItem)
Name

이 형식의 이름을 가져옵니다.

(다음에서 상속됨 EdmType)
NamespaceName

이 형식의 네임스페이스를 가져옵니다.

(다음에서 상속됨 EdmType)
Properties

ComplexType의 속성 목록을 가져옵니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetCollectionType()

이 형식의 요소를 가진 CollectionType의 인스턴스를 반환합니다.

(다음에서 상속됨 EdmType)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

이 형식의 전체 이름을 반환합니다.

(다음에서 상속됨 EdmType)

적용 대상