PropertyKind 열거형

정의

개념적 모델의 항목 특성 종류를 지정합니다.

public enum class PropertyKind
public enum PropertyKind
type PropertyKind = 
Public Enum PropertyKind
상속
PropertyKind

필드

Extended 1

항목 특성이 임을 나타내는 열거형 멤버입니다 Extended.

System 0

항목 특성이 임을 나타내는 열거형 멤버입니다 System.

예제

다음 코드 샘플에서는 연결에서 메타데이터 작업 영역을 가져온 다음 이 메타데이터 작업 영역을 사용하여 지정된 데이터 모델의 확장 속성에 대한 정보를 검색하는 방법을 보여 줍니다. 메타데이터 작업 영역은 메타데이터 검색을 지원하는 런타임 서비스 구성 요소입니다.

코드 샘플에서는 CSpace를 사용하여 모델을 지정합니다. CSpace는 개념적 모델의 기본 이름을 나타냅니다. 코드 샘플에서는 AdventureWorks 모델을 사용합니다.

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

class UsePropertyKindExample  
{  
   static void Main(string[] args)  
   {  
     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=AdventureworksContext"))  
       {  
          // Open the connection.  
          connection.Open();  

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

          // Display the extended properties in the conceptual model.  
          DisplayProperties(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 DisplayProperties(  
        MetadataWorkspace workspace, DataSpace model)  
   {  
      // Get a collection of the entity containers.  
      ReadOnlyCollection<EntityContainer> containers =  
          workspace.GetItems<EntityContainer>(model);  

      // Iterate through the collection to get each entity container.  
      foreach (EntityContainer container in containers)  
      {  
          // Display the extended properties for the entity container.  
          DisplayExtendedProperties(container);  

          // Iterate through the collection to get each entity set.  
          foreach (EntitySetBase baseSet in container.BaseEntitySets)  
          {  
              // Check whether this instance is an EntitySet.  
              if (baseSet is EntitySet)  
              {  
                 // Display the extended properties for the entity set.  
                 DisplayExtendedProperties(baseSet);  
              }  
          }  
      }  

      // Get a collection of the entity types.  
      ReadOnlyCollection<EntityType> entities =   
             workspace.GetItems<EntityType>(model);  

      // Iterate through the collection to get each entity type.  
      foreach (EntityType entity in entities)  
      {  
         // Display the extended properties for the entity type.  
         DisplayExtendedProperties(entity);  
      }  
   }  

   private static void DisplayExtendedProperties(MetadataItem item)  
   {  
     foreach (MetadataProperty property in item.MetadataProperties)  
     {  
         if (property.PropertyKind == PropertyKind.Extended)  
           Console.WriteLine(string.Format("\t{0}\t{1}\t{2}",   
             item.GetType().Name, property.Name, property.Value));  
     }  
   }  
}  

적용 대상